Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/365.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 单击netsuite?中的“自定义”按钮可以显示记录的编辑页?_Javascript_Netsuite_Suitescript_Editmode - Fatal编程技术网

Javascript 单击netsuite?中的“自定义”按钮可以显示记录的编辑页?

Javascript 单击netsuite?中的“自定义”按钮可以显示记录的编辑页?,javascript,netsuite,suitescript,editmode,Javascript,Netsuite,Suitescript,Editmode,我想通过单击自定义按钮而不是“标准编辑按钮”来显示记录的编辑页面 我的代码: Script Version: Suite Script 2.0 User Event Script: function beforeLoad(context) { log.debug('Test', 'Before Load Event Initiated'); var frm = context.form; frm.clientScriptFileId =

我想通过单击自定义按钮而不是“标准编辑按钮”来显示记录的编辑页面

我的代码:

Script Version: Suite Script 2.0
User Event Script:
    function beforeLoad(context) {

        log.debug('Test', 'Before Load Event Initiated');
        var frm = context.form;
        frm.clientScriptFileId = 2250;

        //Values from System/ScriptContext
        var record = context.newRecord;
        if (context.type == context.UserEventType.VIEW) {
            frm.addButton({
                id: 'custpage_cust_edit_btn',
                label: 'Deactivate Record',
                functionName: 'customRecordEditMode(' + record.id + ')'
            });
        }

    }

Client Script:

    function customRecordEditMode(recordID) {
        debugger;
        try {
            window.location.href = "https://system.sandbox.netsuite.com/app/common/custom/custrecordentry.nl?rectype=194&id=" + recordID + "&e=T";
        } catch (exception) {
            alert("Error:", exception.message);
        }
    }
错误消息:

Script Version: Suite Script 2.0
User Event Script:
    function beforeLoad(context) {

        log.debug('Test', 'Before Load Event Initiated');
        var frm = context.form;
        frm.clientScriptFileId = 2250;

        //Values from System/ScriptContext
        var record = context.newRecord;
        if (context.type == context.UserEventType.VIEW) {
            frm.addButton({
                id: 'custpage_cust_edit_btn',
                label: 'Deactivate Record',
                functionName: 'customRecordEditMode(' + record.id + ')'
            });
        }

    }

Client Script:

    function customRecordEditMode(recordID) {
        debugger;
        try {
            window.location.href = "https://system.sandbox.netsuite.com/app/common/custom/custrecordentry.nl?rectype=194&id=" + recordID + "&e=T";
        } catch (exception) {
            alert("Error:", exception.message);
        }
    }
我收到以下错误消息:

但当我们单击标准的“编辑”按钮时,记录的url与中的相同。(i,e)rectype=194&id=237&e=T


提前感谢

我不太清楚为什么原始URL会出现此错误,但是您是否尝试过使用
N/URL
模块而不是使用原始URL

require(['N/url','N/record'],函数(url,r){
var output=url.resolvecord({
记录类型:r.Type.SALES\U ORDER,
记录编号:6,
isEditMode:true
});
});
或者更好的是
N/redirect
模块:

require(['N/redirect','N/record'],函数(redirect,r){
重新定向记录({
“类型”:r.type.TASK,
“id”:6,
“isEditMode”:真
});
});

您的代码似乎缺少许多所需的2.0部分。但是,据我所知,从文件上看,addButton仅适用于suitelets。它是N/ui/serverWidget模块的一部分。对不起,我再也帮不上忙了。