SuiteQLTask.addInboundDependency(options)

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Adds a scheduled script task or map/reduce script task as a dependent task to the SuiteQL task.

Dependent tasks are processed automatically using SuiteCloud Processors when the SuiteQL task is complete. For more information, see SuiteCloud Processors.

You can add a dependent task in the following ways:

  • Provide a task.ScheduledScriptTask object or task.MapReduceScriptTask object that represents the dependent task as the only parameter to this method.

  • Provide an Object as the only parameter that includes values for the following properties:

    • taskType

    • scriptId

    • deploymentId (optional)

    • params (optional)

    For descriptions of these properties, see Parameters.

Important:

You can add only scheduled scripts or map/reduce scripts as dependent tasks to asynchronous SuiteQL tasks. Other script types are not supported. You can add only one dependent task per call to SuiteQLTask.addInboundDependency(options).

When you use this method to add a dependent task, the added task is considered an inbound dependency of the SuiteQL task. For example, if you add a scheduled script task to a SuiteQL task as a dependent task, the scheduled script depends on the SuiteQL task. Because SuiteQLTask.addInboundDependency(options) is called on the SuiteQL task, any dependent task that you add is considered an inbound dependency.

Returns

void

Supported Script Types

Server scripts

For more information, see SuiteScript 2.x Script Types.

Governance

None

Module

N/task Module

Parent Object

task.SuiteQLTask

Sibling Object Members

SuiteQLTask Object Members

Since

2020.2

Parameters

Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

options.scriptId

string

required

The script ID of the scheduled script record or map/reduce script record for the dependent task.

options.taskType

string

required

The type of dependent task.

This property uses one of the following values in the task.TaskType enum:

  • task.TaskType.SCHEDULED_SCRIPT

  • task.TaskType.MAP_REDUCE

options.deploymentId

string

optional

The script ID of the script deployment record for the dependent task.

To use this property, the scheduled script or map/reduce script for the dependent task must be deployed. If you do not specify a value for this property, an available deployment is selected automatically.

options.params

Object

optional

The parameters for the scheduled script or map/reduce script.

To use this property, you must first create script parameters that are required for the dependent task. For example, if your dependent task requires a reference to the CSV result file, you must create a script parameter that maps the CSV result file ID to the file name, as in the following example:

                      { 'custscript_query_res' : 'resultFile.csv'
} 

                    

For more information about script parameters, see Creating Script Parameters (Custom Fields).

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
...
// Be sure to use a script ID that represents a scheduled script in your account
var myScheduledScript = task.create({
    taskType: task.TaskType.SCHEDULED_SCRIPT,
    scriptId: 'customscript_as_ftr_ss'
});

// mySuiteQLTask is an existing task.SuiteQLTask object
mySuiteQLTask.addInboundDependency(myScheduledScript);
...
// Add additional code 

          

Related Topics

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

General Notices