admin管理员组

文章数量:1287581

I want to disable (or) Hide the standard "Edit" Button on the View Mode of the Custom Record Type. Instead Of Standard Button i have used custom button to access the edit page of the record to particular users. So i want to disable the standard edit button.

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: I'm unable to get the ID of the "Edit" Button. It is getting the NULL value.

It is Possible to Disable (or) Hide on the view mode of the record using client script (or) User Event Script.

Thanks in advance.

I want to disable (or) Hide the standard "Edit" Button on the View Mode of the Custom Record Type. Instead Of Standard Button i have used custom button to access the edit page of the record to particular users. So i want to disable the standard edit button.

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: I'm unable to get the ID of the "Edit" Button. It is getting the NULL value.

It is Possible to Disable (or) Hide on the view mode of the record using client script (or) User Event Script.

Thanks in advance.

Share Improve this question asked Sep 22, 2016 at 5:07 Deepan MuruganDeepan Murugan 7713 gold badges22 silver badges42 bronze badges
Add a ment  | 

4 Answers 4

Reset to default 7

Version: SuiteScript 2.0

USER Event Script Before Load Event:

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

The only time I saw the Edit button dissappear is when the record is locked via workflow.

You can create a simple 1 state workflow to lock the record depending on the user role.When you lock the record edit button automatically disappear for the intended user roles.This would be less intrusive way of removing the edit button.

Maybe this is a little bit of late, but for others who want to know the answer. I used the below code to remove the button.

var form = context.form;

form.removeButton('edit');

本文标签: