SuiteScript 2.0 is the recommended API version for new SuiteScript development. Particularly, SuiteScript 2.0, it categorizes and separates the APIs into modules. Modules have replaced unstructured files.
We will update the modules regularly, however you can find some of them below as:
scriptContext. newRecord
User Script/** *@NApiVersion 2.x *@NScriptType UserEventScript */ define(['N/record'], function(record) { function function_call(context) { var order_record = context.newRecord; var order_id=order_record.id } return { afterSubmit: function_call }; } );Client Script/** * @NApiVersion 2.x * @NScriptType ClientScript */ define(['N/search'], function(search) { function function_call(context) { var order_record = context.currentRecord; var order_id=order_record.id; } return { fieldChanged: function_call } });
define Function
Use the define() function to load SuiteScript 2.0 modules and create custom modules. By using the define() function, it loads all dependencies before it executes any logic.
/** * @NApiVersion 2.x * @NScriptType UserEventScript */ define(['N/record'],