Step 3: Overriding the Configure Method
Do the following:
- In the
RSSVWorkOrderWorkflow
class, declare the static Configure method as the following code shows.protected static void Configure(WorkflowContext<RSSVWorkOrderEntry, RSSVWorkOrder> context) { }
In the code above, the Configure method has one parameter of the WorkflowContext type, which has two type parameters: the graph of the form for which workflow is defined, and the primary DAC of the form.
- Override the Configure(PXScreenConfiguration config) method and call
the static Configure method inside it, as the following code
shows.
public sealed override void Configure (PXScreenConfiguration config) { Configure(config.GetScreenConfigurationContext<RSSVWorkOrderEntry, RSSVWorkOrder>()); }
In the code above, you have gotten the current context of the screen configuration for the Repair Work Orders (RS301000) form by specifying the form graph and primary DAC as parameters of the GetScreenConfigurationContext method.
- In the static Configure method, add a template for defining the
default workflow, as the following code
shows.
context.AddScreenConfigurationFor(screen => screen .StateIdentifierIs<RSSVWorkOrder.status>() .AddDefaultFlow(flow => ...) );
In the code above, you have added a new screen configuration for the Repair Work Orders form, specified the field that is the state identifier and started adding the default workflow by calling the AddDefaultFlow method.
The state-identifier is the field that holds the state value for the workflow definition. You specify this field by calling the StateIdentifierIs method and providing the field name as a generic parameter.
In the next activities (such as Workflow States: To Define a Workflow State and Transitions: To Implement a Simple Transition), you will define a function inside the AddDefaultFlow method that specifies the settings of the default workflow.
Important:If you specified the state identifier field, you need to add a workflow by calling either the AddDefaultFlow or AddWorkflow method. - Save your changes.
Now you are ready to add the definition of the workflow to the screen configuration.