Defining a New Workflow
In this example, defining workflows for working with a lead is described. Suppose, you need to define a workflow for a process of changing the status of a lead on the Leads (CR301000) form. Statuses and actions that switch the status are presented in the following diagram.
A lead can have the following statuses:
- New. This is the initial status of a created lead. A user can change a lead's status from New to Open by selecting the Open action.
- Open. A user can change a lead's status from Open to Converted by selecting the Convert to Contact action.
- Converted. A user can change the lead's status by selecting the
Close action. The status is changed from Converted to
Closed in case the
Attention
field of a lead has the C value (which is determined by Condition 1), from Converted to Open if theAttention
field of a lead has the O value (which is determined by Condition 2). - Closed.
Based on this description, you can define a workflow for a lead by doing the following:
- Add the Leads form to the list of customized screens.
- On the Conditions page, define conditions depending on which the Converted status is changed
- On the Dialog Boxes page, define dialog boxes that request a user to enter values needed to perform actions.
- On the Workflows page, create a workflow.
- On the Workflow (Tree View) or Workflow (Diagram View) pages, define states of the created workflow.
- For each state, you define a list of actions available for this state.
- For each action, you define a transition that this action performs.
Add the Leads form to the List of Customized Screens
To add the form in the list of customized screens, do the following:
- Open Customization Project Editor.
- In the navigation pane, click Screens.
- On the page toolbar, click .
- In the Customize Existing Screen dialog box which opens, select the Leads form.
- Click OK.
The Leads form is displayed on the Customized Screens page and in the navigation page under the Screens node.
For details on adding a form to the list of customized screens, see Workflow Creation: To Add a Workflow.
Define Conditions
To define conditions for the Close action, do the following:
- In the navigation pane of Customization Project Editor, select
The Conditions: CR301000 (Leads) page opens.
. - Add the condition which is fulfilled changes the status to Closed by doing the
following:
- On the Conditions pane, click Add New Record.
- In the Condition Properties dialog box which opens, type the name of the condition in the Condition Name box: Condition Close.
- On the table toolbar, click Add Row and specify the following
values:
- Field Name: Attention
- Condition: Equals
- Value: 'C'
- Click OK.
- Add the condition which is fulfilled changes the state to Open. To do that, repeat
the steps from the previous bullet. In the Condition Properties dialog
box, specify the following values:
- Field Name: Attention
- Condition: Equals
- Value: 'O'
For details on adding a condition, see Conditions and Transitions: To Add Conditions and Conditions and Transitions: General Information.
Define Dialog Boxes
When a user opens a lead, he should specify a reason for opening it. The reason is stored in
the Reason
field of the Leads form. To request the Reason
field value from the user when he selects the Open action, you define a
dialog box as follows:
- In the navigation pane of Customization Project Editor, select
The CR301000 (Leads) Dialog Boxes page opens.
. - In the Dialog Boxes pane, click +.
The New Dialog Box dialog box opens.
- In the Dialog Box Name box, specify the name of the dialog box: Reason.
- Click OK.
- In the Dialog Box Fields table, enter the following values:
- Schema Field: PX.Objects.CR.Contact.Resolution
- Field Name: Resolution
- Display Name: Reason
- Default Value: Assign
- On the page toolbar, click Save.
For details on creating dialog boxes, see Dialog Boxes: General Information and Workflow Elements: To Add a Dialog Box.
Create a Workflow
To create a new workflow, do the following:
- In the navigation pane of Customization Project Editor, select
The CR301000 (Leads) Workflows page opens.
Note:The Leads form has a predefined workflow for which the State Identifying box value is already specified.
. - On the page toolbar, click Add Workflow.
- In the Add Workflow dialog box which opens, specify the following
values:
- Operation: Create New Workflow
- Workflow Type: DEFAULT
- Workflow Name: DEFAULT
- Click OK.
In the page table, the new row appears.
- Clear the Active box for the predefined workflow, and select the Active box for the created workflow.
- On the page toolbar, click Save.
- Click the name of the created workflow in the table.
The Workflow Editor page opens. Now you can proceed with defining states of a lead for the new workflow.
Define States for the Workflow
To define statuses of a lead, do the following:
- In the navigation pane of Customization Project Editor, select
The CR301000 (Leads) Workflows: Default page opens.
. - Define the New status of the lead by doing the following:
- In the States and Transitions pane, click .
- In the Add State dialog box which opens, specify the following
values:
- Identifier: N
- Description: New
- Click OK.
The New status appears in the Statuses and Transitions navigation pane.
- On the State Properties tab, select the Initial State of
the Workflow box. It means that when a lead is created, the
Status
field (which is selected as a state identifier by default) of the lead is assigned the New value. - In the Fields table of the State Properties
tab, add the following rows:
Object Name Field Name Disabled Hide Required Default Value Lead/Contact Owner cleared cleared cleared @me Lead/Contact Company Name cleared cleared selected empty Lead/Contact Workgroup selected cleared cleared empty The table rows define the state of boxes on the Leads form when a lead has the New status. For example, the @me default value of the
Owner
field name means the Owner box is assigned the name of the current MYOB Acumatica user. For details on possible filter values, see Managing Advanced Filters. - On the page toolbar, click Save.
- Define the Open, Converted, and Closed states of the workflow by following the same instruction.
Define Actions for Each State
For the New state, the Open action changes the state of a lead to Open. To define this action, do the following:
- In the States and Transitions pane, select the New state.
- On the tab toolbar, click Create Action.
- In the New Action dialog box which opens, specify the following
values:
- Action Name: Open
- Display Name: Open
- Place in Folder: Actions
- Click OK.
- In the row that appears, in the Dialog Box column, select the dialog box you defined previously, Reason.
- On the Update Fields tab, define fields that should be updated before
the action method is invoked. Do the following:
- On the tab toolbar, click Add Row.
- In the new row, specify the following values:
- Field: Reason
- Value: [Reason.Resolution]
- On the page toolbar, click Save.
According to the diagram of the workflow shown at the beginning of the example, for the rest of the states you should specify the following actions and transitions:
- For the Open state: the Convert to Contact action
- For the Converted state: the Close action
Define a Transition for an Action
For the New action, define a transition as follows:
- In the States and Transitions pane, select the New state.
- On the pane toolbar, click .
- In the Add Transition dialog box which opens, specify the following
values:
- Transition Name: Open
- Action Name: Open
- Condition: cleared
- Target State: Open
- Click OK.
The Open (Open->Open) transition appears in the States and Transitions pane.
- On the page toolbar, click Save.
For the Convert to Contact action of the Open state, define the Convert (Convert to Contact->Converted) transition. For the Close action of the Converted state, define two transitions: one with the Condition box value set to Condition 1, and another with the Condition box value set to Condition 2.
The resulting States and Transitions pane should look as shown in the following screenshot.