ScheduledScriptTask.submit()

Note:

The content in this help topic pertains to SuiteScript 2.0.

Method Description

Directs NetSuite to place a scheduled script deployment into the NetSuite scheduling queue and returns a unique ID for the task.

Additionally, note the following:

  • The scheduled script must have a status of Not Scheduled on the Script Deployment page. If the script status is set to Testing on the Script Deployment page, this method will not place the script into the scheduling queue.

  • If the deployment status on the Script Deployment page is set to Scheduled, the script will be placed into the queue according to the time(s) specified on the Script Deployment page. If submitted scheduled scripts are requested at the same time or rapidly in succession, the scheduled tasks may not proceed to the Queued status.

  • Only roles with the SuiteScript Scheduling permission or Administrators can run scheduled scripts executed by API. If a user event script calls ScheduledScriptTask.submit(), the user event script must be initiated by a role with permission.

  • A scheduled script can be submitted for processing only if there is no unfinished scheduled script task for the same script ID and script deployment ID. Therefore, if a scheduled script resubmits itself, the resubmit does not occur until the current execution completes. This delay is necessary to avoid the existence of two unfinished tasks for the same deployment of the same script. For this reason, if a scheduled script uses the submit() method to resubmit itself, then at runtime, no task ID is returned when the scheduled script is submitted.

Returns

string

The task ID as a string, except as noted above.

Supported Script Types

Server scripts

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

Governance

20 units

Module

N/task Module

Since

2015.2

Errors

Error Code

Message

Thrown If

FAILED_TO_SUBMIT_JOB_REQUEST_1

Failed to submit job request: {reason}

Task cannot be submitted.

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 scheduledScriptTaskId = scriptTask.submit();
...
//Add additional code 

        

Related Topics

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

General Notices