Step 1: Investigate the Source Code

To begin customizing the predefined workflow, you need to investigate how the composite state is defined in it. In Step 2: Adding a Workflow Extension, you learned that the workflow for the Invoices (SO303000) form is defined in the SOInvoiceEntry_Workflow class and that the statuses of the workflow are defined in the ARDocStatus class.

You will investigate the source code of the SOInvoiceEntryWorkflow class by doing the following:

  1. In Visual Studio, in the SmartFix_T270 website project, go to App_Data/CodeRepository/PX.Objects/SO/Workflow, and open the SOInvoiceEntry_Workflow.cs file.
  2. In the SOInvoiceEntry_Workflow class, locate the AddSequence<State.HoldToBalance> method call. This call defines the HoldToBalance composite state. Notice the order in which the nested states are defined, and locate the creditHold state. After the creditHold state, you can see the pendingPrint state, which will be the next state for the new postponed state.
  3. In the code of the SOInvoiceEntry_Workflow class, notice that the states of the workflow are defined in the ARDocStatus class. You will need the name of the class to add the custom state.
  4. Go to the definition of the ARDocStatus class, and note how the states are defined.
  5. For the purpose of adding a new status value, learn the name of the field that holds the status value on the Invoices form by using the Element Inspector. This field is ARInvoice.Status.