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

Is there any way to Disable (or) Remove the Netsuite Standard Edit Button on the View Mode of the Custom Record

我想禁用(或)隐藏自定义记录类型的查看模式中的标准 "Edit" 按钮。 我使用自定义按钮而不是标准按钮为特定用户访问记录的编辑页面。所以我想禁用标准编辑按钮。

我的代码:

脚本版本:Suite Script 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;
    }
}

错误: 我无法获取 "Edit" 按钮的 ID。它正在获取 NULL 值。

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

提前致谢。

我唯一一次看到“编辑”按钮消失是在通过工作流锁定记录时。

版本:SuiteScript 2.0

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

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

您可以创建一个简单的 1 状态工作流来 锁定 记录,具体取决于用户 role.When 您锁定记录编辑按钮会自动对目标用户消失 roles.This 删除编辑按钮的侵入性较小。

也许这有点晚了,但对于其他想知道答案的人来说。我使用下面的代码删除了按钮。

var form = context.form;

form.removeButton('edit');