首页 文章

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

提问于
浏览
1

I want to disable (or) Hide the standard "Edit" Button on the View Mode of the Custom Record Type. 而不是标准按钮我使用自定义按钮访问特定用户的记录的编辑页面 . 所以我想禁用标准编辑按钮 .

My Code:

Script Version: Suite Script 2.0

Client Script

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;
    }
}

ERROR: 我无法获取"Edit"按钮的ID . 它获取NULL值 .

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

提前致谢 .

3 回答

  • 1

    我看到“编辑”按钮消失的唯一时间是通过工作流程锁定记录的时间 .

  • 1

    您可以根据用户角色创建一个简单的1状态工作流来记录 lock 记录 . 当您锁定记录时,编辑按钮会自动消失以用于预期的用户角色 . 这将是一种不太干扰的删除编辑按钮的方法 .

  • 2

    Version: SuiteScript 2.0

    USER Event Script Before Load Event:

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

相关问题