SuiteScript 1.0 to 2.1 reference
nlapiScheduleScript in SuiteScript 2.1
In SuiteScript 2.1, nlapiScheduleScript is replaced by task.create from N/task. Queues a scheduled script to run.
Before and after
// SuiteScript 1.0
nlapiScheduleScript('customscript_sync', 'customdeploy_sync', { custscript_batch: 3 });// SuiteScript 2.1
define(['N/task'], (task) => {
const t = task.create({
taskType: task.TaskType.SCHEDULED_SCRIPT,
scriptId: 'customscript_sync',
deploymentId: 'customdeploy_sync',
params: { custscript_batch: 3 },
});
const taskId = t.submit();
});What to watch for
- submit() returns a task id you can check with task.checkStatus.
- Scripts that rescheduled themselves to work around governance are usually better rewritten as Map/Reduce.
Related functions
- nlapiYieldScript becomes Map/Reduce script
- nlapiSendEmail becomes email.send
- nlapiRequestURL becomes https.get / https.post / https.request
- All SuiteScript 1.0 functions
Find what still needs converting
Find every script that still calls nlapiScheduleScript
SuiteMigrate lists the active 1.0 and 2.0 scripts in your NetSuite account, shows which ones you can read and which are locked, and drafts 2.1 conversions you review before deploying. Free for 5 conversions.
Examples are simplified. Test converted code in a NetSuite sandbox before deploying. SuiteMigrate is not affiliated with Oracle or NetSuite.