Composite States: To Modify a Workflow with a Composite State
The following activity will walk you through the process of modifying a composite state in the invoice workflow.
Story
On the Invoices (SO303000) form, the default workflow includes a composite state with multiple nested states.
Suppose that you want to add a new state, Postponed, to the composite state in the workflow for the Invoices form after the Credit Hold state. Further suppose that you need to specify a skip condition for it and add a transition from this state to the next state in the workflow.
If a user specifies a discount for an invoice, you want this invoice to be reviewed and the discount to be approved before the user can proceed with processing the invoice. After the discount is approved, the system specifies the business date in the Cash Discount Date box. The skip condition will check for no cash discount being applied to the invoice. That is, if the user does not specify any discount, the system will skip the Postponed state.
Process Overview
By using the Workflows page, you will create an inherited workflow for the Invoices (SO303000) form. By using the Workflow (Tree View) page, you will add a nested state to the workflow. On the Conditions page, you will specify a condition that the system will use to skip this state. You will then add a transition from the state to the next nested state on the Workflows page.
System Preparation
Before you begin performing the steps of this activity, do the following:
- Launch the MYOB Acumatica website with the U100 dataset preloaded, and sign in as system
administrator by using the gibbs username and the 123
password.Tip: The gibbs user is assigned the Administrator role, which has sufficient access rights to customize workflows.
- Make sure you have learned how to perform workflow customization, as described in Inherited Workflows: General Information.
- Unpublish your current customization project or projects by doing the
following:
- Open the Customization Projects (SM204505) form.
- On the form toolbar, click Unpublish All.
- On the Customization Projects (SM204505) form, create a customization project named Invoices.
Step 1: Adding a Form to the List of Customized Screens
Add the Invoices (SO303000) form to the list of customized screens as follows:
- In MYOB Acumatica, open the Customization Projects (SM204505) form.
- In the table with the customization projects, click the Invoices
link.
The Customization Project Editor opens for the Invoices customization project. You will use this project for the customization.
- In the navigation pane of the Customization Project Editor, click Screens.
- On the page toolbar of the Customized Screens page, which is opened, click Customize Existing Screen.
- In the Customize Existing Screen dialog box, which is opened, select Invoices (SO303000).
- Click OK to close the dialog box.
The Screen Editor: (SO303000) Invoices page of the Customization Project Editor opens.
Step 2: Creating an Inherited Workflow for the Form
Create a customized workflow for the Invoices (SO303000) form as follows:
- In the navigation pane of the Customization Project Editor, click
The SO303000 (Invoices) Workflows page of the Customization Project Editor opens. Notice that the table on the page contains one workflow: Default Workflow.
. - On the page toolbar, click Add Workflow.
- In the Add Workflow dialog box, which opens, specify the
following settings:
- Operation: Extend System Workflow
- Base Workflow: Default Workflow
- Workflow Type: DEFAULT
- Workflow Name: Invoices (the name of the workflow that will be displayed on the Workflow page)
- Click OK to close the dialog box.
A row for the workflow appears in the table on the Workflows page. Notice that the workflow’s status is Inherited, which means that this workflow is based on a predefined workflow.
- Select the Active check box for the created workflow.
Notice that the Active check box has been cleared automatically for the predefined workflow (Default Workflow). This means that the system will not use this workflow for the form anymore.
- On the page toolbar, click Save.
- In the table, click the link in the Workflow Name column
for the created workflow.
The SO303000 (Invoices) State Diagram: Invoices page opens.
Step 3: Adding a Condition
To add a skip condition that the system will use to skip the
Postponed
state, perform the following instructions:
- In the navigation pane, click
The Conditions: SO303000 (Invoices) page opens.
. - On the page toolbar, click Add New Record.
- In the Conditions Properties dialog box, which opens, type DiscountEmpty as the condition name.
- On the table toolbar, add a row with the following settings:
- Field Name: Discount Total (OrderDiscTotal)
- Condition: Equals
- From Schema: Selected
- Value: 0
- Make sure the Active check box is selected for the added row.
- Click OK to save your changes and close the dialog
box.
The added condition appears in the list of conditions on the Conditions: SO303000 (Invoices) page.
Step 4: Adding a Nested State
To add a new nested state to the composite state, perform the following instructions:
- In the navigation pane, click
The SO303000 (Invoices) State Diagram: Invoices page opens.
. - On the page toolbar, click Add State.
- In the Add State dialog box, which opens, specify the
following settings:
- Identifier: Q
- Description: Postponed
- Parent State: H->B
- Click OK to close the dialog box.
In the States and Transitions pane, the system adds the
Postponed
state after the last nested state (Balanced
in this case). - With
Postponed
selected in the pane, use the arrows on the pane toolbar to move the added state after theCredit Hold
state. - With the
Postponed
state still selected, select DiscountEmpty in the Skip Condition box of the State Properties tab.If the condition is fulfilled (that is, if the value in the Cash Discount box is 0) and a document is ready to enter the
Postponed
state, it then skips this state and automatically moves to the next state (Pending Print
in this case). - Save your changes.
Step 5: Adding a Transition
To add a transition from the added state to the next nested state of the composite state, perform the following instructions:
- While you are still on the SO303000 (Invoices) State Diagram: Invoices page,
click the
Postponed
state. - On the page toolbar, click Add Transition.
- In the Add Transition dialog box, which is opened, click Create to the right of the Trigger Name box.
- In the New Action dialog box, which is opened, specify
the following settings for the action:
- Action Name: DiscountApproved
- Display Name: Discount Approved
- Category: Processing
- Click OK to close the New Action dialog box.
- In the Target State box of the Add
Transition dialog box, select @Next.
This setting indicates that the transition will lead to the next state in the sequence (
Pending Print
in this case). - Click OK to close the dialog box.
The system adds the transition to the Transitions node of the
Postponed
state. - In the States and Transitions pane, click the
Postponed
state. - On the table toolbar of the Fields to Update on Exit tab
(in the lower part of the State Properties tab) for this
state, click Add Row and specify the following
settings:
- Active: Selected
- Field Name: Cash Discount Date
- From Schema: Cleared
- New Value: =Now()
Each time a document leaves the
Postponed
state, the value of the Cash Discount Date field changes to the current date. This happens when the document moves to another state because the transition has been triggered by theDiscount Approved
action. - Save your changes.
Step 6: Publishing the Customization Project
Publish the customization project as follows:
- On the menu of the Customization Project Editor, click .
- After the system finishes updating the required data, click Close Compilation Pane.
Step 7: Testing Your Changes
Test your changes as follows:
- In MYOB Acumatica, go to the Invoices (SO303000) form. You need to refresh the form if you were already viewing it before the publication of the project.
- Test the workflow for an invoice that requires discount approval:
- Create a new invoice for the customer with the CITRUS ID. Leave other settings in the Summary area as they are specified by default.
- On the tab toolbar of the Details tab, click
Add Row, and specify the following settings
in the added row:
- Branch: HEADOFFICE (specified automatically)
- Inventory ID: KIWIJAM96
- Transaction Descr.: Kiwi jam 96 oz (specified automatically)
- Warehouse: RETAIL (specified automatically)
- Location: JS1
- Quantity: 20
- On the form toolbar, click Save.
- In the Document Discounts box of the Summary area of the form, enter 5.
- On the form toolbar, click Remove Hold.
The status of the invoice changes to Postponed.
- On the More menu, click Discount Approved.
The status of the invoice changes to Balanced, and the value in the Cash Discount Date box is the current date.
- Test the workflow for an invoice that does not require discount approval:
- Create another invoice for the customer with the GROCERIEX ID.
- On the tab toolbar of the Details tab, click
Add Row, and specify the following settings
in the added row:
- Branch: HEADOFFICE (specified automatically)
- Inventory ID: APPLES
- Transaction Descr.: Fresh apples 1 lb (specified automatically)
- Location: Main
- Quantity: 7
- On the form toolbar, click Save.
- On the form toolbar, click Remove Hold.
The status of the invoice changes to Balanced. Because you have not specified any value in the Document Discounts box, the system skipped the
Postponed
state and moved the invoice to the next state in the composite state (Balanced
in this case).