Hide the Delete button from core_company table.

ServiceNowSteve
Giga Guru

Good Afternoon All,

Today we has a user acidently delete a company record from our core_company table and as a result I am trying to hide the Delete button (Not use an ACL to restrict) and despite my searching all I can find as a solution is to use the UI Policy to make it visible to noly users with admin roles which is fine but when I add gs.hasRole("admin") to the global Delete condition it does nothing for the ITIL users.

Anyway the one way I did get the delete button to disappear was a client script that used.

var items = $$('BUTTON').each(function(item)

  {

              if(item.innerHTML.indexOf('Delete') > -1)

{

                      item.hide();

              }

      });

but that also deleted it from the Admin role....so I guess I need a little guidance on how to hide the option from only ITIL users and not Admin users on a specific table.

1 ACCEPTED SOLUTION

adamjgreenberg
ServiceNow Employee
ServiceNow Employee

ACL's are the best way to hide items from specific groups of users.



As you found out, javascript can hide such an item, but it is global in nature.


View solution in original post

10 REPLIES 10

Deepak Kumar5
Kilo Sage

Delete should be available for admin users only for all tables(Specially for Core tables).


Use ACL for delete access as all above suggested to restrict.