Step 2: Specifying the Workflow-Identifying Field in the Workflow

In this step, you will extend the screen configuration of the Repair Work Orders (RS301000) form and specify the workflow identifying field in it by calling the FlowTypeIdentifierIs method.

Do the following:

  1. In the extension library, create an extension of the RSSVWorkOrderWorkflow class as shown in the following code.
            public class RSSVWorkOrderWorkflow_Extension :
            PXGraphExtension<RSSVWorkOrderWorkflow, RSSVWorkOrderEntry>
            {         }
  2. In the RSSVWorkOrderWorkflow_Extension class, define the set of constant string values and corresponding classes for the value of the UsrOrderType field which will later be used as values of the workflow-identifying field as the following code shows.
                #region Constants 
                public static class OrderTypes
                {
                    public const string Simple = WorkOrderTypeConstants.Simple;
                    public const string Standard = WorkOrderTypeConstants.Standard;
                    public const string Awaiting = WorkOrderTypeConstants.Awaiting;
    
                    public class simple : PX.Data.BQL.BqlString.Constant<simple>
                    {
                        public simple() : base(Simple) { }
                    }
    
                    public class standard : PX.Data.BQL.BqlString.Constant<standard>
                    {
                        public standard() : base(Standard) { }
                    }
    
                    public class awaiting : PX.Data.BQL.BqlString.Constant<awaiting>
                    {
                        public awaiting() : base(Awaiting) { }
                    }
                }
                #endregion
    Note: Use Acuminator to suppress the PX1016 error in a comment. In this course, for simplicity, the extension is always active.
  3. In the RSSVWorkOrderWorkflow_Extension class, override the Configure method as the following code shows.
                public sealed override void Configure(PXScreenConfiguration config)
                {
                    Configure(config.GetScreenConfigurationContext<RSSVWorkOrderEntry,
                                                                   RSSVWorkOrder>());
                }
    
                protected static void Configure(WorkflowContext<RSSVWorkOrderEntry,
                                                                 RSSVWorkOrder> context)
                {
                }
  4. In the Configure (WorkflowContext<RSSVWorkOrderEntry, RSSVWorkOrder> context) method, update the screen configuration and specify the workflow identifying field as the following code shows.
                    context.UpdateScreenConfigurationFor(screen => screen
                     .FlowTypeIdentifierIs<RSSVWorkOrder_Extension.usrOrderType>());
  5. Save your changes.