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:
-
Scheduled Scripts: Each entry on the Scheduled Script Status page contains information about a single scheduled script instance. Each scheduled script instance is handled by one scheduled script job. To access the Scheduled Script Status page in the UI, go to Customization > Scripting > Scheduled Script Status.
-
Map/Reduce Scripts: Each entry on the Map/Reduce Script Status page contains information about a single map/reduce script instance. Each map/reduce script instance is handled by multiple map/reduce script jobs. To access the Map/Reduce Script Status page in the UI, go to Customization > Scripting > Map/Reduce Script Status. You can access information about the individual map/reduce jobs for a particular map/reduce script instance from the map/reduce script details page. To access this page from the Map/Reduce Script Status page, click Details for the appropriate script instance.
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.
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 ( |
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.
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 ( |
This field holds a numeric value that corresponds to the original priority value:
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 ( |
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();