SuiteTips: Script Calling Sequence in NetSuite - Valid combinations

 Script Calling Sequence


There have been situations where we should know script sequence which could call another script in order to perform an execution. So, I have prepared possible combinations based on my experience which I will keep updating based on scenarios I have implemented till now.




TYPE CALLING USECASE METHOD
User Event Client Script To add button var btnSend = form.addButton({ id: 'custpage_sendbutton', label: 'Sample Button', functionName: "Call Button('" + arg + "')" }); form.clientScriptModulePath = "SuiteScripts/clientscript_cs.js";
----- ----- ----- -----
User Event Suitelet To call a PDF script var suiteletUrl = url.resolveScript({ scriptId: 'customscript_suitelet', // Your Suitelet script ID deploymentId: 'customdeploy_suitelet', // Your Suitelet deployment ID returnExternalUrl: false, params: {recId: rec.id, recType: rec.type} });
----- ----- ----- -----
User Event Map Reduce To call MR Job on record submit var mapReduceScriptTask = task.create({ taskType: task.TaskType.MAP_REDUCE });
----- ----- ----- -----
Client Suitelet To call a batch Job or redirection var suiteletUrl = url.resolveScript({ scriptId: 'customscript_suitelet', // Your Suitelet script ID
----- ----- ----- -----
Client Custom record To redirect to custom batch job record or standard record var relativePath = url.resolveRecord({ recordType: 'customrecord_type', recordId: tran_GET, isEditMode: false });
----- ----- ----- -----
Suitelet Map Reduce To call a batch Job to run batch of invoices same as map reduce call
----- ----- ----- -----
Suitelet Saved Search To redirect to a search created within script redirect.toSearchResult({ search: ourNewSearch });
----- ----- ----- -----
Suitelet Custom record To redirect to custom record var relativePath = url.resolveRecord({ recordType: 'customrecord_type', recordId: tran_GET, isEditMode: false });
----- ----- ----- -----
Map reduce Map reduce To form a sequence of events var mapReduceScriptTask = task.create({ taskType: task.TaskType.MAP_REDUCE }); 
----- ----- ----- -----
Restlet Map reduce To invoke a batch job as soon data comes in from third party like mapreduce called earlier