我在尝试编辑NetSuite中的CUSTOMER记录时遇到了以下问题。我创建的脚本非常简单。
如果用这么简单的代码,我怎么可能做错呢?
{"type":"error.SuiteScriptModuleLoaderError","name":"MODULE_DOES_NOT_EXIST","message":"Module does not exist: /SuiteScripts/BillingInfoUpdated.js","stack":[]}
脚本:
define(['N/log'], function (log) {
/**
* User Event 2.0 example showing usage of the Submit events
*
* @NApiVersion 2.x
* @NModuleScope SameAccount
* @NScriptType UserEventScript
* @appliedtorecord customer
*/
var exports = {};
function afterSubmit(scriptContext) {
log.debug({
"title": "After Submit",
"details": "action=" + scriptContext.type
});
}
exports.afterSubmit = afterSubmit;
return exports;
});
将.js添加到脚本文件名的末尾
请改用:
var LOGMODULE; //Log module is preloaded, so this is optional
/**
*@NApiVersion 2.x
*@NModuleScope Public
*@NScriptType UserEventScript
*/
define(['N/log'], runUserEvent);
function runUserEvent(log) {
LOGMODULE = log;
var returnObj = {};
returnObj.afterSubmit = afterSubmit;
return returnObj;
}
function afterSubmit(context) {
log.debug('After Submit', "action=" + context.type);
//LOGMODULE.debug('After Submit', "action=" + context.type); //Alternatively
//context.newRecord; //Just showing how to access the records
//context.oldRecord;
//context.type;
return;
}
有关更多2.0快速入门示例:ursuscode.com