Workflow State Actions
In SuiteCloud Development Framework (SDF), state actions are grouped in the workflowactions
structure of a workflow state. The workflowactions
element requires a triggertype
attribute to indicate when the group of actions execute. Each action defined in the structure has its own nested structure and a unique element name, such as addbuttonaction
, sendemailaction
, and setfieldvalueaction
.
All action types share common action properties, triggers, and conditions. The names of these elements may vary depending on the type of action you specify.
Workflow actions are subrecords, so the deletion rules vary during deployment based on the SuiteCloud project type that the workflow is in. For more information, see Differences Between SuiteCloud Projects.
For more information about the available elements that you can specify in various workflow actions, see the following:
The following example shows a workflow state that contains two addbuttonaction
actions:
<workflow scriptid="customworkflow1">
<name>My custom workflow</name>
<recordtypes>LEAD</recordtypes>
...
<workflowstates>
...
<workflowstate scriptid="workflowstate_approvalpending">
<name>State 2: Pending Approval</name>
...
<workflowactions triggertype="BEFORELOAD">
<addbuttonaction scriptid="workflowaction_approvebutton">
<checkconditionbeforeexecution>T</checkconditionbeforeexecution>
<conditionsavedsearch></conditionsavedsearch>
<contexttypes></contexttypes>
<eventtypes></eventtypes>
<isinactive>F</isinactive>
<label>Approve</label>
<saverecordfirst>F</saverecordfirst>
<initcondition>
<formula><![CDATA[{salesrep.supervisor.id}={me}]]></formula>
<type>FORMULA</type>
</initcondition>
</addbuttonaction>
<addbuttonaction scriptid="workflowaction_rejectbutton">
<checkconditionbeforeexecution>T</checkconditionbeforeexecution>
<conditionsavedsearch></conditionsavedsearch>
<contexttypes></contexttypes>
<eventtypes></eventtypes>
<isinactive>F</isinactive>
<label>Reject</label>
<saverecordfirst>F</saverecordfirst>
<initcondition>
<formula><![CDATA[{salesrep.supervisor.id}={me}]]></formula>
<type>FORMULA</type>
</initcondition>
</addbuttonaction>
</workflowactions>
</workflowstate>
...
</workflowstates>
...
</workflow>
You can create Sublist Action Groups in workflows for transactions when you work with them in SDF. A Sublist Action Group is a group of actions assigned to a workflow state that is to be executed on each line of a sublist. For more information, see Using Sublist Action Groups.
SDF supports the following Sublist Action Groups:
-
Create Record
-
Return User Error
-
Send Email
-
Set Field Value
The following is an example of a workflow sublist action group as it is defined in a workflow SDF custom object:
<workflow scriptid="customworkflow_sample">
...
<workflowsublistactiongroup scriptid="workflowaction123">
<conditionsavedsearch/>
<contexttypes/>
<eventtypes/>
<isinactive>F</isinactive>
<scheduledelay/>
<schedulemode>DELAY</schedulemode>
<schedulerecurrence/>
<scheduletimeofday/>
<scheduletimeunit/>
<sublist>ITEM</sublist>
<initcondition>
<formula/>
<type>VISUAL_BUILDER</type>
</initcondition>
<setfieldvalueaction scriptid="workflowaction456">
<field>STDBODYSHIPZIP</field>
<isinactive>F</isinactive>
<valuechecked>F</valuechecked>
<valuedate/>
<valuefield/>
<valueformula/>
<valuejoinfield/>
<valueselect/>
<valuetext>SDC</valuetext>
<valuetype>STATIC</valuetype>
<initcondition>
<formula/>
<type>VISUAL_BUILDER</type>
</initcondition>
</setfieldvalueaction>
</workflowsublistactiongroup>
...
</workflow>
Create Line Action
You can define a create line action using createlineaction
. The action adds a new line to a sublist and can be inserted as the first or last line in the sublist. You can also specify default values for line fields, and the values can be static or dynamically defined.
Use createlineaction
when lines need to be added to a sublist at certain points in the workflow. The createlineaction
element can be added to a workflow state as an individual action using workflowactions
, and as part of an action group using workflowactiongroup
. The createlineaction
element can be specified in workflow definitions on record types that contain a sublist supported by SuiteFlow.
For more information about:
-
Using a create line action in the NetSuite UI, see Create Line Action.
-
Using actions in a workflow, see Working with Actions.
-
Setting field values in actions, see Setting Field Values in Action Definitions.
The following example shows a workflow state that contains a create line action that adds the field STDCOLISCLOSED
as a new line in the ITEM sublist when the workflow advances to the Rejected state:
<workflow scriptid="customworkflow245">
<name>Sales Order Basic Approval</name>
<recordtypes>SALESORDER</recordtypes>
<releasestatus>RELEASED</releasestatus>
...
<workflowstates>
...
<workflowstate scriptid="workflowstate8">
<description></description>
<donotexitworkflow>F</donotexitworkflow>
<name>Rejected</name>
<positionx>463</positionx>
<positiony>223</positiony>
...
<workflowactions triggertype="ONENTRY">
<createlineaction scriptid="workflowaction41">
<conditionsavedsearch></conditionsavedsearch>
<contexttypes></contexttypes>
<eventtypes></eventtypes>
<isinactive>F</isinactive>
<position>AFTERLASTLINE</position>
<sublist>ITEM</sublist>
<initcondition>
<formula></formula>
<type>VISUAL_BUILDER</type>
</initcondition>
<fieldsettings>
<fieldsetting>
<targetfield>STDCOLISCLOSED</targetfield>
<valuechecked>T</valuechecked>
<valuedate></valuedate>
<valuefield>STDBODYCOMPLETE</valuefield>
<valueformula></valueformula>
<valuejoinfield></valuejoinfield>
<valueselect></valueselect>
<valuetext></valuetext>
</fieldsetting>
</fieldsettings>
</createlineaction>
...
</workflowactions>
</workflowstate>
...
</workflowstates>
</workflow>
Workflow Action Parameter Sections
Some action types let you specify a parameter fields. In the NetSuite UI, these fields are located in the Parameters section. For example, the following is an image of the Parameters section of an Initiate Workflow action in NetSuite:

In SDF, parameter fields are grouped in a structure of the workflow action. The name of this structure depends on the action type. You can create parameter fields in SDF for the following actions:
-
Create Record Action Types. For information, see fieldsettings and Creating and Subscribing to a Record.
-
Custom Action Types. For information, see parametersettings.
-
Go to Record Action Types. For information, see fieldsettings.
-
Initiate Workflow Action Types. For information, see workflowfieldsettings.
-
Transform Record Action Types. For information, see fieldsettings.