Hide Update and Delete Buttons

Vineetha Rohra1
Giga Guru

I have a custom table. When i open its form, fill it and save it a record gets generated.

When i open this particular record, update and delete buttons appear on the form which i dont want to appear.

How to hide them on load of the form of any record. I mean if i open that record, these 2 buttons should not be visible on the form.

Any help please.

1 ACCEPTED SOLUTION

Hi Brian,



Thanks for the suggestion, i tried modifying condition for update ui action and added condition as tablename != (my custom table's name) and it worked. I did the same for delete ui action as well.


View solution in original post

7 REPLIES 7

Vineetha Rohra1
Giga Guru

I also tried the following:



//Remove the 'Submit' button
var items = $$('BUTTON').each(function(item){
      if(item.innerHTML.indexOf('Update') > -1){
            item.hide();  
      }
});




This didn't work.


fkhan
Kilo Guru

Try This:



function onLoad() {



  hideIncidentButton('update');


  hideIncidentButton('delete');


  //add more button name


  function hideIncidentButton(button) {


  //Remove   button


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


  if(item.innerHTML.indexOf(button) > -1){


  item.hide();


  }


  });


  }


  }


check this post:how to hide the button if state is rejected



please mark helpful or correct if applicable


Thanks,


Farukh


It did not work, the buttons are still appearing on the form.


brian_degroot
ServiceNow Employee
ServiceNow Employee

HI Vineetha,



My recommendation for hiding these buttons would be to adjust the condition in their respective sys_ui_action record. UI Actions will only be presented if the condition is met. Hiding the buttons through client script may create a sluggish user experience, and may even be shown to the users for a brief moment, so I think this is a better approach to handling this.



Thank you,



Brian