workflow.trigger(options)
Method Description |
Triggers a workflow on a record. The actions and transitions of the workflow are evaluated for the record in the workflow instance, based on the current state for the workflow instance. Returns the internal ID of the workflow instance used to track the workflow against the record. |
Returns |
number |
Supported Script Types |
Server scripts For more information, see SuiteScript 2.x Script Types |
Governance |
20 units |
Module |
|
Since |
2015.2 |
Parameters
The options
parameter is a JavaScript object.
Parameter |
Type |
Required / Optional |
Description |
Since |
---|---|---|---|---|
|
string | number |
optional |
The internal ID of a button that appears on the record in the workflow. Use this parameter to trigger the workflow as if the specified button were clicked. |
2015.2 |
|
string |
required |
The record ID of the workflow base record. |
2015.2 |
|
string |
required |
The record type ID of the workflow base record. Use values from the record.Type enum. This is the Record Type field on the Workflow Definition Page. |
2015.2 |
|
string | number |
optional |
The internal ID (number) or script ID (string) of the workflow state that contains the action. |
2015.2 |
|
string | number |
required |
The internal ID (number) or script ID (string) for the workflow definition. This is the ID field on the Workflow Definition Page. |
2015.2 |
|
string | number |
optional |
The internal ID of the workflow instance. |
2015.2 |
Syntax
The following code snippet shows the syntax for this member. It is not a functional example. For a complete script example, see N/workflow Module Script Sample.
//Add additional code
...
var workflowInstanceId = workflow.trigger({
recordId: '5', // replace with an actual record id
recordType: 'salesorder',
workflowId: 'custworkflow_name',
actionId: workflowaction25
});
...
//Add additional code