Step 2: Adding a Workflow State and a Transition
In this step, you will define the Completed workflow state and the
transition from the Assigned workflow state to the
Completed workflow state. Do the following:
- In the lambda expression for the WithFlowStates method, add the
definition of the
Completedworkflow state, as the following code shows.flowStates.Add<States.completed>(flowState => GetCompletedBehavior(flowState)); -
In the
RSSVWorkOrderEntry_Workflowclass, add theGetCompletedBehaviorprivate static method, as the following code shows.private static BaseFlowStep.IConfigured GetCompletedBehavior( FlowState.INeedAnyFlowStateConfig flowState) { return flowState .WithFieldStates(states => { states.AddField<RSSVWorkOrder.customerID>(state => state.IsDisabled()); states.AddField<RSSVWorkOrder.serviceID>(state => state.IsDisabled()); states.AddField<RSSVWorkOrder.deviceID>(state => state.IsDisabled()); }); }In the method, you have made theCustomerID,ServiceID, andDeviceIDfields unavailable for editing. - In the WithTransitions method, define the transition from the
Assignedworkflow state to theCompletedworkflow state, as the following code shows.transitions.AddGroupFrom<States.assigned>( transitionGroup => { transitionGroup.Add(transition => transition.To<States.completed>() .IsTriggeredOn(graph => graph.Complete)); });
