MODULE_DOES_NOT_EXIST SuiteScript

Coo*_*ova 5 netsuite suitescript

我在尝试编辑NetSuite中的CUSTOMER记录时遇到了以下问题.我创建的脚本非常简单.

如果用这么简单的代码,我怎么可能做错呢?

{"type":"error.SuiteScriptModuleLoaderError","name":"MODULE_DOES_NOT_EXIST","message":"Module does not exist: /SuiteScripts/BillingInfoUpdated.js","stack":[]}
Run Code Online (Sandbox Code Playgroud)

脚本:

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;
});
Run Code Online (Sandbox Code Playgroud)

Nat*_*and 14

将.js添加到脚本文件名的末尾

  • 是的,谢谢!OP,请接受这个答案。绝对是正确的。 (2认同)

Avi*_*Avi 5

内森·萨瑟兰(Nathan Sutherland)的答案对我有用,而且绝对没问题,但我写这个答案是为了让新用户更快地获得答案,而不会与其他名称混淆。您需要添加.js蓝色箭头指向的位置。

创建脚本时启动。 这里

如果您忘记了,请在此处编辑

NS


Ado*_*rza 0

使用这个代替:

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;
}
Run Code Online (Sandbox Code Playgroud)

有关更多 2.0 快速入门示例:ursuscode.com