Hiding Update and Save Buttons for Incidents in Resolved status.

Glynn_Parker1
Kilo Explorer

I am trying to figure out how I can hide the Update and Save form buttons for incidents in a status of Resolved.

Today, where an incident is resolved, our customers see both the update and save buttons, along with Accept Solution (when clicked the incident moves into closed) and Reject Solution (when clicked the incident moves back to in progress) buttons.

We have found that many users ignore the accept/reject buttons, and simply add additional comments (if the incident is not resolved the users satisfaction), and click either the Update or Save buttons. This renders the accept/reject buttons somewhat obselete. Worse still, the support teams do not see the update, so we end up with unresolved ticket still in a status of resolved. This lack of visibility tends to lead to multiple complaints.

The solution I'd like to achieve is that the update and save buttons disappear (for the end user only) when an incident moves into a resolved status. They should remain available for ITIL role holders. The thoery being, end users are forced to use the accpet or reject buttons as appropriate.

I have tried playing around with UI actions, with little success and my scipting knowledge is at best somewhat limited.

Any ideas?

Thanks

9 REPLIES 9

Mark Stanger
Giga Sage

You should be able to do this with an 'onLoad' client script on the incident table. The following ServiceNowGuru article shows how to hide form buttons with a script...

http://www.servicenowguru.com/scripting/client-scripts-scripting/removing-form-buttons/

Here is a script that should work assuming your state field is visible on the end user form and it is named 'state', not 'incident_state'. You can adjust the script as needed to meet your needs.



function onLoad(){
//If the user does not have the itil role and the incident is resolved
if(!g_user.hasRole('itil') && g_form.getValue('state') == 6){
//Remove the 'Save' and 'Update' buttons
var items = $$('BUTTON').each(function(item){
if(item.innerHTML.indexOf('Save') > -1){
item.hide();
}
if(item.innerHTML.indexOf('Update') > -1){
item.hide();
}
});
}
}


The gift that keeps on giving!   Worked like a charm for me as well.   Thank you!


Thanks Mark it is working perfect, but it has some flaw in that for hiding Save button,



I tried to hide the Save button but it also hides the Save and Close button also.



Can you help me out hide only Save button.


Just change the 'if' statement that checks the 'Save' button to exclude the 'Save and Close' button.



//If we see 'Save' and don't see 'Close'


if(item.innerHTML.indexOf('Save') > -1 && item.innerHTML.indexOf('Close') == -1){


    item.hide();


}