task.WorkflowTriggerTask

Note:

The content in this help topic pertains to SuiteScript 2.0.

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 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.x Script Types.

Module

N/task Module

Since

2015.2

Syntax
Important:

The following code sample shows the syntax for this member. It is not a functional example. For a complete script example, see N/task Module Script Samples.

          //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 

        

Related Topics

N/task Module
SuiteScript 2.x Modules
SuiteScript 2.x

General Notices