Step 3: Overriding the Configure Method

To implement a workflow, you will override the Configure method, which accepts the PXScreenConfiguration instance. Inside the Configure(PXScreenConfiguration config) method, you will call the static Configure method. In the static Configure method, you will get the configuration context object, which you will later use to add the new screen configuration.
Note: Declaring the static Configure method and calling in it the overridden Configure(PXScreenConfiguration config) method is important to ensure that no static methods are called inside the Configure(PXScreenConfiguration config) method and the PXOverride attribute cannot be applied to the method. For more details, see Screen Configuration: Restrictions of the Configure Method.

Do the following:

  1. 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.

  2. 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.

  3. 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.
  4. Save your changes.

Now you are ready to add the definition of the workflow to the screen configuration.