Modules

filter

 

Objects/Functions

module (N/task)

SuiteScript 2.0

task.WorkflowTriggerTask

// Please search https://system.netsuite.com/app/help/helpcenter.nl?search=task.WorkflowTriggerTask for more information.

N/task Module
task.WorkflowTriggerTask
Object Description: All the properties required to asynchronously initiate a workflow. Use the WorkflowTriggerTask Object to create a task that initiates an instance of the specified workflow. The task is placed in the scheduling queue, and the workflow instance is initiated after the task reaches the top of the queue. task.WorkflowTriggerTask does not successfully place a workflow job in queue if an identical instance of that workflow (with the same recordType, id, and workflowId) is currently executing or already in the scheduling queue. To use the WorkflowTriggerTask Object: Use task.create(options) to create the WorkflowTriggerTask Object. Use WorkflowTriggerTask.recordType to set the record type of the workflow base record. Use WorkflowTriggerTask.recordId to set the internal ID of the base record for the workflow. Use WorkflowTriggerTask.workflowId to set the internal ID of the workflow that you want to run on the record specified by the recordId. Optionally, use WorkflowTriggerTask.params to specify default values for workflow fields. Use WorkflowTriggerTask.submit() to submit the asynchronous workflow initiation task to the NetSuite task queue. Use the properties for the WorkflowTriggerTaskStatus.status object to get the status of the workflow execution. Use the following guidelines with the WorkflowTriggerTask Object: WorkflowTriggerTask.submit() does not successfully place a workflow task in the scheduling queue if an identical instance of that workflow, with the same recordType, recordId, and workflowId, is currently executing or already in the scheduling queue. For a complete list of this object’s methods and properties, see WorkflowTriggerTask Object Members. To initiate a workflow on demand, see workflow.initiate(options).
Supported Script Types: Server scripts For more information, see SuiteScript 2.0 Script Types.
Module: N/task Module
Since: 2015.2
Search NetSuite - https://system.netsuite.com/app/help/helpcenter.nl?search=task.WorkflowTriggerTask

Example:

// Code Example 1
//Add additional code
//...
var workflowTask = task.create({taskType: task.TaskType.WORKFLOW_TRIGGER});
workflowTask.recordType = 'customer';
workflowTask.recordId = 107;
workflowTask.workflowId = 3;
var taskId = workflowTask.submit();
//...
//Add additional code

//SOURCE: https://system.netsuite.com/app/help/helpcenter.nl?fid=section_4345799266.html