- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 09:04 AM
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 a major 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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 10:20 AM
@Luke James - Please try the script below. I have not tested it but please try the script.
var IncidentUtils = Class.create();
IncidentUtils.prototype = Object.extendsObject(IncidentUtilsSNC, {
initialize: function() {
IncidentUtilsSNC.prototype.initialize.call(this);
},
/***************Custom changes****************/
canCloseIncident: function(current) {
if (current.incident_state != IncidentState.RESOLVED)
return false;
if (gs.hasRole("itil_admin"))
return true;
if (this._isMajorIncident(current))
return (gs.hasRole("major_incident_manager"));
else if (current.caller_id == gs.getUserID())
return true;
return false;
},
type: 'IncidentUtils'
});
IncidentUtils.isCopyIncidentEnabled = function(current) {
var incidentUtils = new IncidentUtils();
return incidentUtils.isCopyIncidentFlagValid();
};
IncidentUtils.isCreateChildIncidentEnabled = function(current) {
var incidentUtils = new IncidentUtils();
return incidentUtils.isCreateChildIncidentFlagValid();
};
If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 10:06 AM
Hi @Luke James ,
Yes, that is correct. You need to make changes to the IncidentUtils script include and override the canCloseIncident function to incorporate your condition.
If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 10:08 AM
Hi @Saloni Suthar , thanks very much for this.
Any idea on how to do that? I've been struggling with the code for it in IncidentUtils.
Kind regards,
Luke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2024 10:20 AM
@Luke James - Please try the script below. I have not tested it but please try the script.
var IncidentUtils = Class.create();
IncidentUtils.prototype = Object.extendsObject(IncidentUtilsSNC, {
initialize: function() {
IncidentUtilsSNC.prototype.initialize.call(this);
},
/***************Custom changes****************/
canCloseIncident: function(current) {
if (current.incident_state != IncidentState.RESOLVED)
return false;
if (gs.hasRole("itil_admin"))
return true;
if (this._isMajorIncident(current))
return (gs.hasRole("major_incident_manager"));
else if (current.caller_id == gs.getUserID())
return true;
return false;
},
type: 'IncidentUtils'
});
IncidentUtils.isCopyIncidentEnabled = function(current) {
var incidentUtils = new IncidentUtils();
return incidentUtils.isCopyIncidentFlagValid();
};
IncidentUtils.isCreateChildIncidentEnabled = function(current) {
var incidentUtils = new IncidentUtils();
return incidentUtils.isCreateChildIncidentFlagValid();
};
If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni