Workflow State Creation
In SuiteCloud Development Framework (SDF), workflow states are defined in a workflow SDF custom object. Workflow states are grouped within the workflowstates
structure. In this structure, you can create as many states as needed by specifying a workflowstate
structure for each state. Each workflowstate
structure contains elements and structures to define its workflow state fields, transitions that lead to other states, and actions. For more information about the available elements that you can specify for a workflow state, see the following:
The following example shows a workflow object that contains a series of states, with basic elements defined for each state:
<workflow scriptid="customworkflow1">
<name>My custom workflow</name>
<recordtypes>LEAD</recordtypes>
...
<workflowstates>
<workflowstate scriptid="workflowstate_entry">
<name>State 1: Entry</name>
<donotexitworkflow>F</donotexitworkflow>
<positionx>213</positionx>
<positiony>33</positiony>
...
</workflowstate>
<workflowstate scriptid="workflowstate_approvalpending">
<name>State 2: Pending Approval</name>
<donotexitworkflow>F</donotexitworkflow>
<positionx>213</positionx>
<positiony>123</positiony>
...
</workflowstate>
<workflowstate scriptid="workflowstate_approved">
<name>State 3a: Approved</name>
<donotexitworkflow>F</donotexitworkflow>
<positionx>213</positionx>
<positiony>213</positiony>
...
</workflowstate>
<workflowstate scriptid="workflowstate_rejected">
<name>State 3b: Rejected</name>
<donotexitworkflow>F</donotexitworkflow>
<positionx>213</positionx>
<positiony>303</positiony>
...
</workflowstate>
</workflowstates>
...
</workflow>
Workflow State Transitions
In SuiteCloud Development Framework (SDF), state transitions are defined in the workflow state that they derive from. Transitions are grouped within the workflowtransitions
structure of the workflow state. In this structure, you can create as many transitions as needed by specifying a workflowtransition
structure for each transition. Each workflowtransition
structure contains elements to define the destination state, when the transition should occur, and other basic properties. For more information about the available elements that you can specify for a workflow transition, see the following:
The following example shows a workflow object that contains three states, where one state contains transitions to the other states depending on a button action:
<workflow scriptid="customworkflow1">
<name>My custom workflow</name>
<recordtypes>LEAD</recordtypes>
...
<workflowstates>
...
<workflowstate scriptid="workflowstate_approvalpending">
<name>State 2: Pending Approval</name>
...
<workflowtransitions>
<workflowtransition scriptid="workflowtransition_approveclick">
<buttonaction>
[scriptid=customworkflow_approvals.workflowstate_approvalpending.workflowaction_approvebutton]
</buttonaction>
<conditionsavedsearch></conditionsavedsearch>
<contexttypes></contexttypes>
<eventtypes></eventtypes>
<scheduledelay></scheduledelay>
<scheduletimeunit></scheduletimeunit>
<tostate>[scriptid=customworkflow_approvals.workflowstate_approved]</tostate>
<triggertype></triggertype>
<waitforworkflow></waitforworkflow>
<waitforworkflowstate></waitforworkflowstate>
<initcondition>
<formula></formula>
<type>VISUAL_BUILDER</type>
</initcondition>
</workflowtransition>
<workflowtransition scriptid="workflowtransition_rejectclick">
<buttonaction>
[scriptid=customworkflow_approvals.workflowstate_approvalpending.workflowaction_rejectbutton]
</buttonaction>
<conditionsavedsearch></conditionsavedsearch>
<contexttypes></contexttypes>
<eventtypes></eventtypes>
<scheduledelay></scheduledelay>
<scheduletimeunit></scheduletimeunit>
<tostate>[scriptid=customworkflow_approvals.workflowstate_rejected]</tostate>
<triggertype></triggertype>
<waitforworkflow></waitforworkflow>
<waitforworkflowstate></waitforworkflowstate>
<initcondition>
<formula></formula>
<type>VISUAL_BUILDER</type>
</initcondition>
</workflowtransition>
</workflowtransitions>
</workflowstate>
<workflowstate scriptid="workflowstate_approved">
<name>State 3a: Approved</name>
...
</workflowstate>
<workflowstate scriptid="workflowstate_rejected">
<name>State 3b: Rejected</name>
...
</workflowstate>
</workflowstates>
...
</workflow>