SearchTask.addInboundDependency()

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Adds a scheduled script task (task.ScheduledScriptTask) or map/reduce script task (task.MapReduceScriptTask) to the search task as a dependent script. Dependent scripts are processed automatically when the search task is complete. For more information, see SuiteCloud Processors.

Note:

You can add only scheduled scripts or map/reduce scripts as dependent scripts to asynchronous search tasks. Other script types are not supported.

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

Returns

void

Supported Script Types

Server scripts

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

Governance

None

Module

N/task Module

Since

2018.2

Parameters
Note:

The options parameter is a JavaScript object.

Parameter

Type

Required / Optional

Description

Since

dependentScript

task.ScheduledScriptTask | task.MapReduceScriptTask

Required

The script to add as a dependent script to the search task.

Use task.create(options) and the task.TaskType enum to create a script task with a type of SCHEDULED_SCRIPT or MAP_REDUCE. This script task is a task.ScheduledScriptTask object or a task.MapReduceScriptTask, and you can add this script task as a dependent script to the search task. The dependent script is processed when the search task is complete.

You can add only one dependent script per call to SearchTask.addInboundDependency().

2018.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 scheduledScript = task.create({
    taskType: task.TaskType.SCHEDULED_SCRIPT
});
// Set the properties of the scheduled script task
scheduledScript.scriptId = 'customscript_as_ftr_ss';

var asyncTask = task.create({
    taskType: task.TaskType.SEARCH
});
// Set the properties of the search task
asyncTask.savedSearchId = 'customsearch35';

asyncTask.addInboundDependency(scheduledScript);
var asyncTaskId = asyncTask.submit();
...
// Add additional code 

        

Related Topics

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

General Notices