Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Netsuite SuiteScript 2. x – Scheduled Script

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: 

  1. scheduled – normal execution according to the deployment options specified in the UI.
  2. ondemand – the script is executed using a scheduled API.
  3. userinterface – the script is executed via the UI (On click of the Save & Execute button). 
  4. aborted – re-executed automatically immediately after an aborted execution (system went down during execution).
  5. 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:[email protected]

Contact No: +91 844-844-8939 (& Press 3)

You may also be interested in reading this:

Suite Script 2.0

How to handle Tax Collection at Source (TCS) in NetSuite

NetSuite for Manufacturing Business Processes

Understanding SUITELET 2. x Basics

Billing Schedule in NetSuite

Bank Reconciliation In NetSuite By Import

Vendor Prepayments in NetSuite 

Marketing Campaign and Marketing Template 

The post Netsuite SuiteScript 2. x – Scheduled Script appeared first on NetSuite Blog | Saturotech.



This post first appeared on ERP Is Not A Just Software It's A Backbone Of Your Company. Choose Wisely., please read the originial post: here

Share the post

Netsuite SuiteScript 2. x – Scheduled Script

×

Subscribe to Erp Is Not A Just Software It's A Backbone Of Your Company. Choose Wisely.

Get updates delivered right to your inbox!

Thank you for your subscription

×