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:
- 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. - In the
SOInvoiceEntry_Workflow
class, locate theAddSequence<State.HoldToBalance>
method call. This call defines theHoldToBalance
composite state. Notice the order in which the nested states are defined, and locate thecreditHold
state. After thecreditHold
state, you can see thependingPrint
state, which will be the next state for the new postponed state. - 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.
- Go to the definition of the ARDocStatus class, and note how the states are defined.
- 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
.