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
Completed
workflow state, as the following code shows.flowStates.Add<States.completed>(flowState => GetCompletedBehavior(flowState));
-
In the
RSSVWorkOrderEntry_Workflow
class, add theGetCompletedBehavior
private static method, as the following code shows.
In the method, you have made theprivate 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()); }); }
CustomerID
,ServiceID
, andDeviceID
fields unavailable for editing. - In the WithTransitions method, define the transition from the
Assigned
workflow state to theCompleted
workflow state, as the following code shows.transitions.AddGroupFrom<States.assigned>( transitionGroup => { transitionGroup.Add(transition => transition.To<States.completed>() .IsTriggeredOn(graph => graph.Complete)); });