Reputation: 23
I'm creating a Scheduled SuiteScript in Netsuite that uses the 2.0 version of the API.
I want to create record,but some errors have occurred.
The script is:
/**
*@NApiVersion 2.x
*@NScriptType ScheduledScript
*@author Sheldor Qu
*@description 此脚本用于每天定时更新采购价格税率维护表
*@version V1.0.0
*/
define(['N/record'], function (record) {
function execute(context) {
try {
var customTaskRecord = record.create({
type: 'customrecord_tp_dev_task',
isDynamic: true,
});
log.debug('new customTaskRecord', customTaskRecord);
} catch (error) {
log.debug('error', error);
}
}
return {
execute: execute
}
});
The error message is:
{
"type": "error.SuiteScriptError",
"name": "SSS_MISSING_REQD_ARGUMENT",
"message": "task.checkStatus: Missing a required argument: options.taskId",
"stack": [
"createError(N/error)",
"execute(/SuiteScripts/Scheduled Script/TP_SS_PurchasePriceUpdDaily.js:12)"
],
"cause": {
"type": "internal error",
"code": "SSS_MISSING_REQD_ARGUMENT",
"details": "task.checkStatus: Missing a required argument: options.taskId",
"userEvent": null,
"stackTrace": [
"createError(N/error)",
"execute(/SuiteScripts/Scheduled Script/TP_SS_PurchasePriceUpdDaily.js:12)"
],
"notifyOff": false
},
"id": "",
"notifyOff": false,
"userFacing": false
}
I don't know why,please help me.
Upvotes: 2
Views: 1976
Reputation: 1270
I believe you are getting the error from another script trying to check the status of a task.
var taskStatus = task.checkStatus(taskId);
but taskId is null or undefined or missing. Make sure that script sets a variable when submitting the task that you can use as your task id.
var taskId = scriptTask.submit();
Upvotes: 0