Scheduled scripts are server-side scripts in NetSuite that are processed with SuiteCloud Processors to process a large number of data/records.
These scripts can be used to submit once that will be used for processing in the future on a recurring basis and also can be used to submit on-demand scripts to the deployment record or to submit from another script using an API.
For example, this script can be used to:
- log some basic information on a recurring basis
- schedule the script execution for maintenance
- create and update or remove temporary records
- asynchronous execution of a script within another server script
- trigger another schedule script
- send data to a suitelet
- send data to a restlet.
- trigger user events on a record.
Note: A governance limit for every scheduled script instance is of a maximum of 10,000 usage units.
Scheduled scripts can be executed in below contexts:
- scheduled – normal execution according to the deployment options specified in the UI.
- ondemand – the script is executed using a scheduled API.
- userinterface – the script is executed via the UI (On click of the Save & Execute button).
- aborted – re-executed automatically immediately after an aborted execution (system went down during execution).
- skipped – executes automatically immediately after a downtime during which the script should have been executed.
Schedule Script Example:
Update the memo field on sales orders returned from the saved search.
/**
*@NApiVersion 2.x
*@NScriptType ScheduledScript
*/
define([‘N/record’, ‘N/search’],
function(record, search) {
function execute(scriptContext) {
var searchObj = search.load({ id: ‘customsearch_reverseChargeSales’ }) //load the saved search
searchObj.run().each(function(result){
var soId = record.submitFields({
type: record.Type.SALES_ORDER,
id: result.id,
values: {
memo: ‘Reverse Charge’
}
});
});
}
return {
execute: execute
};
});
Steps to create Scheduled Scripts:
- Step 1: create a file in javascript
- Step 2: Go to Customization ->Scripting -> Scripts -> New -> Upload File.
- Step 3: Create a new Script Record using the file.
- Step 4: Enter Name, ID and populate other fields as per need.
- Step 5: Click the buttons named Save and Deploy
- Step 6: Update the title if you want and enter the id
- Step 7: Set the values in the status, log level and priority
- Step 8: Schedule the Script through Schedule TAB options.
- Step 9: Save.
Learn More: Scheduled Script
To Know more about NetSuite Cloud ERP, feel free to reach us on:
Website: https://saturotech.com/
Email ID:sales@saturotech.com
Contact No: +91 844-844-8939 (& Press 3)
You may also be interested in reading this:
How to handle Tax Collection at Source (TCS) in NetSuite
NetSuite for Manufacturing Business Processes
Understanding SUITELET 2. x Basics
Bank Reconciliation In NetSuite By Import