Scheduled Script Instance

You can use the scheduled script instance search to return information about individual scheduled script and map/reduce script jobs. A subset of this information is displayed on the Scheduled Scripts and Map/Reduce Scripts pages in the NetSuite UI:

For more information about the Scheduled Script Status page, see Scheduled Script Status Page. For more information about the Map/Reduce Script Status page, see Map/Reduce Script Status Page.

For help working with this record in the UI, see SuiteScript Monitoring, Auditing, and Logging.

The internal ID for this record is scheduledscriptinstance.

See the SuiteScript Records Browser for all internal IDs associated with this record.

Note:

For information about using the SuiteScript Records Browser, see Working with the SuiteScript Records Browser in the NetSuite Help Center.

For information about scripting with records in SuiteScript, see the following help topics:

Supported Script Types

The scheduled script instance record is scriptable in server SuiteScript only.

All three user events are supported: beforeLoad, beforeSubmit, and afterSubmit.

Supported Functions

The scheduled script instance record is partially scriptable — it can only be searched. It cannot be created, updated, copied, or deleted using SuiteScript.

Usage Notes

You can script searches on scheduledscriptinstance with all server script types. Scheduled script instance searches are not exposed to client scripts.

For a list of SuiteScript supported scheduledscriptinstance fields, see the SuiteScript Records Browser. In addition, see the following table for supplemental information about a few supported fields.

Field

Notes

Original Priority (originalpriority)

This field holds the original priority setting (low, standard, or high) for the scheduled script job or map/reduce job. The priority setting is the value set when the scheduled script job or map/reduce job is initially created.

  • If a job is created when a deployment is submitted for processing, the original priority is the priority set on the deployment record at the time it was submitted for processing.

  • If a job is created during script processing, the original priority is the current priority of the job that created the new job.

For more information about deployment record priority settings, see SuiteCloud Processors Priority Levels.

Note:

For scheduled scripts, one scheduled script job is created when a script deployment is submitted for processing.

For map/reduce scripts, the initial map/reduce jobs are created when the script deployment is submitted for processing. In addition, more map/reduce jobs can be created during script processing.

Original Priority Number (originalprioritynumber)

This field holds a numeric value that corresponds to the original priority value:

  • High priority: 1

  • Standard priority: 2

  • Low priority: 3

You cannot group your search results by the original priority field because it holds a text value. The original priority number field is provided as an alternative.

Priority Timestamp (prioritytimestamp)

This field holds the time that the current priority is set for the scheduled script job or map/reduce job. This field can reflect the timestamp of a user-defined priority setting change or a system-defined priority setting change. User-defined priority changes do not impact the value of this field for existing jobs. However, system-defined priority changes may impact this value for existing jobs.

For example, if you create a scheduled script deployment and immediately submit the deployment for processing, the priority timestamp for that job reflects the deployment submission time. If you then change the priority on the deployment record, neither the priority nor the priority timestamp for the existing job is changed. However, If you enable priority elevation, and the priority for the existing job is changed by the system, the priority timestamp value is changed accordingly. For more information about priority elevation, see SuiteCloud Processors Priority Elevation and Processor Reservation (Advanced Settings).

Code Sample

The following sample shows how to perform a search for all schedule script instance records that are in progress in queue 2. It uses search filters and columns to return all available information in the filtered results. Note that the first two search columns are joins on the script and script deployment record types.

          var searchResults = search.create ({
    type: 'scheduledscriptinstance',
    filters: [
        {name: 'queue',
         operator: IS,
         values: '2'
        }, 
        {name: 'status',
         operator: ANYOF,
         values: 'PROCESSING'
        }
    ],
    columns: [
        {name: 'name', join: 'script'},
        {name: 'internalid', join: 'scriptdeployment'},
        {name: 'datecreated'},
        {name: 'status'},
        {name: 'startdate'},
        {name: 'enddate'},
        {name: 'queue'},
        {name: 'percentcomplete'},
        {name: 'queueposition'},
        {name: 'percentcomplete'}
    ]
});
var mySearchResults = searchResults.run(); 

        

Related Topics

N/runtime Module
Setting Runtime Options
Scheduled Script Status Page
Map/Reduce Script Status Page
Working with the SuiteScript Records Browser
SuiteScript Supported Records
Customization

General Notices