是否有任何方法可以禁用(或)删除自定义记录的视图模式上的Netsuite标准编辑按钮

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

本文关键字:模式 视图 记录 Netsuite 按钮 编辑按 编辑 标准 自定义 删除 方法      更新时间:2023-09-26

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

我的代码:

脚本版本:Suite Script 2.0

<<p> 客户端脚本/strong>
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;
    }
}

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

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

版本:2.0 SuiteScript

USER Event Script Before Load Event:

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

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

您可以根据用户角色创建一个简单的1状态工作流来锁定记录。当您锁定记录编辑按钮自动消失为预期的用户角色。这将是一种较少干扰的删除编辑按钮的方式。

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

var form = context.form;
form.removeButton('edit');