Netsuite表示在创建自定义模块时包括模块ID,如下所示:
define(module_id, [dependencies], function)
但是我什么时候找不到该模块:
TypeError: Cannot read property "XPELPCenterModule" from undefined (/path/to/mysuitelet.js#35)
当我删除ID时,它起作用了?
Hello Human Coder
我想念的是什么。我是用相同的方式称呼他们
function (ui, email, runtime, search, record, log, render, cache, crypto, file, pcenter) {
var p = new pcenter.XPELPCenterModule();
.....
p.helloWorld('Human Coder');
这是模块代码示例:
define(["require", "exports"],
function (require, exports) {
var XPELPCenterModule = /** @class */ (function () {
function XPELPCenterModule(name) {
this.name = name;
}
XPELPCenterModule.prototype.helloWorld = function (name) {
return 'Hello ' + name;
};
return XPELPCenterModule;
}());
exports.XPELPCenterModule = XPELPCenterModule;
});
define('XPELPCenterModule', ["require", "exports"],
function (require, exports) {
var XPELPCenterModule = /** @class */ (function () {
function XPELPCenterModule(name) {
this.name = name;
}
XPELPCenterModule.prototype.helloWorld = function (name) {
return 'Hello ' + name;
};
return XPELPCenterModule;
}());
exports.XPELPCenterModule = XPELPCenterModule;
});
答案 0 :(得分:4)
诀窍是使用@NAmdConfig并添加模块路径的.json配置文件:
INFORMATION_SCHEMA
.JSON配置文件:
/**
*@NApiVersion 2.0
*@NScriptType Suitelet
*@NModuleScope Public
*@NAmdConfig /path/to/myModule.json
*/