有没有办法禁用(或)删除自定义记录查看模式下的 Netsuite 标准编辑按钮

Dee*_*gan 2 javascript edit netsuite suitescript

我想禁用(或)隐藏自定义记录类型的查看模式上的标准“编辑”按钮。我没有使用标准按钮,而是使用自定义按钮来访问特定用户的记录编辑页面。所以我想禁用标准编辑按钮。

我的代码:

脚本版本:套件脚本 2.0

客户端脚本

function pageInit(scriptContext) {

    var approved = 3;
    var currentRecord = scriptContext.currentRecord;
    var status = currentRecord.getValue("custrecord_lst_ch_status");
    //Hiding The Standard Edit Button When the Status Field is in Approved State
    if (status == approved) {
        document.getElementById("edit").disabled = true;
        document.getElementsByName("edit")[0].disabled = true;
    }
}
Run Code Online (Sandbox Code Playgroud)

错误: 我无法获得“编辑”按钮的 ID。它正在获取 NULL 值。

可以使用客户端脚本(或)用户事件脚本禁用(或)隐藏记录的查看模式。

提前致谢。

Dee*_*gan 6

版本:SuiteScript 2.0

加载事件之前的用户事件脚本:

if (context.type == context.UserEventType.VIEW) {
    var form = scriptContext.form ;
             form.removeButton({
               id :'edit',
              });
}
Run Code Online (Sandbox Code Playgroud)