How to override IncidentUtils script Include

Luke James
Tera Contributor

Good Afternoon All, 

 

I have a requirement where I need to only allow users with the major incident management role to be able to close an incident in the esc portal. I can see that this is controlled within the IncidentUtils script include and IncidentUtilsSNC script include. 

 

How can amend this script include to allow for this behaviour? Can i override the function 

canCloseIncident in the IncidentUtilsSNC script include? 
 
Would really love the help on this as i'm stuck. 
 
Kind Regards, 
 
Luke
3 REPLIES 3

James Chun
Kilo Patron

Hey @Luke James,

 

If the name of a Script Include contains 'SNC', you won't be able to modify it due to its protection policy. Instead, ServiceNow added another Script Include that extends from these Script Includes (i.e. the ones without 'SNC' in the name) to be customizable without impacting the original script.

 

So yes, you can modify the 'canCloseIncident' function within IncidentUtils.

 

Cheers

 

SanjivMeher
Kilo Patron
Kilo Patron

You can create a copy of these script includes so that you dont impact the upgrades in future. And then call the new script includes wherever required.

Another option would be to make changes to the ACL directly to allow only major incident to close the incident.


Please mark this response as correct or helpful if it assisted you with your question.

Sumanth16
Kilo Patron

Hi @Luke James ,

 

Please refer to below thread:

 

https://www.servicenow.com/community/developer-forum/incidentutils-help-writing-reopen-override-scri...

https://www.servicenow.com/community/itsm-forum/reopen-button-on-london-release/m-p/890612

 

If I could help you with your Query then, please hit the Thumb Icon and mark it as Correct !!

 

Thanks & Regards,

Sumanth Meda