Hide OOTB Update Button

KavyasriP460146
Giga Contributor

Hello Everyone,

I have created one custom table and created records in it. So, when I open one of the records, I can be able to see update and delete button which are OOTB. That update button should be visible only to admins and for other users it should be hidden. This should happen only for the table I created. I tried

 

Scenario: 1

OnLoad Client script

var checkAdmin = g_user.hasRole('admin');
    if (!checkAdmin) {
        g_form.hideAction('sysverb_update');
    }
 
Scenario: 2
Display BR
var hide = !gs.hasRole('admin');
    g_scratchpad.hide = hide ? 'true' : 'false';
 
OnLoad Client script
 if (g_scratchpad.hide == 'true') {
        g_form.hideAction('sysverb_update');
    }
 
 
But none of them are working. I need your help here whether this can be achievable or not.
Thanks in advance.

 

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

Look for the UI Action record named Update that is on the Global table.  Change the table on this record to your custom one, and temporarily change the name slightly so you know you're looking at the right one.  Do an Insert and Stay on this record.  This will create a copy of the Update UI Action specific to your custom table.  After you confirm this part has worked as expected, you can make the name / button label whatever you want, and to the  add the Condition &&gs.hasRole('admin') to only show for admins. 

BradBowman_0-1767202512322.png

 

The other approach is to create a write ACL on the custom table that requires the admin role.  The form may appear read-only, but the (out of box) Update button will not be visible as it has the canWrite condition to check for write access to the table.