- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2020 08:55 AM
Hello All,
I am looking to edit the Incident Script Include that calls the IncidentSNC script include. I would like to edit the reopen function in the IncidentSNC script include. I want to clear the assigned to user of the reopened incident. I know that I need to custom the function in the Incident script include. I am looking for examples how to accomplish this. Below are the script includes. Thank you.
// Incident Script Include
var Incident = Class.create();
Incident.prototype = Object.extendsObject(IncidentSNC, {
initialize: function(incidentGr) {
IncidentSNC.prototype.initialize.call(this, incidentGr);
},
type: 'Incident'
});
// IncidentSNC Script Include
var IncidentSNC = Class.create();
IncidentSNC.prototype = {
initialize: function(incidentGr) {
this._gr = incidentGr;
},
_getGr: function() {
return this._gr;
},
hasReopened: function() {
var incidentGr = this._getGr();
return (incidentGr.incident_state.changesFrom(IncidentState.RESOLVED) ||
incidentGr.incident_state.changesFrom(IncidentState.CLOSED) ||
incidentGr.incident_state.changesFrom(IncidentStateSNC.CANCELED)) &&
incidentGr.incident_state != IncidentState.RESOLVED &&
incidentGr.incident_state != IncidentState.CLOSED &&
incidentGr.incident_state != IncidentState.CANCELED;
},
reopen: function(gr, email) {
if (!gr)
return null;
if (gr.state == IncidentState.RESOLVED) {
// If the incident is Resolved
gr.state = IncidentState.IN_PROGRESS;
gr.incident_state = IncidentState.IN_PROGRESS;
gr.work_notes = gs.getMessage("The caller did not feel that this issue was resolved");
gr.update();
return gr;
} else if (gr.state == IncidentState.CLOSED) {
// Create a duplicate incident if this one is Closed
var duplicateIncId = this.clone(gr.sys_id);
var gr2 = new GlideRecord("incident");
gr2.get(duplicateIncId);
gr2.caller_id = email.from_sys_id;
gr2.opened_by = email.from_sys_id;
gr2.contact_type = "email";
gr2.state = IncidentState.IN_PROGRESS;
gr2.incident_state = IncidentState.IN_PROGRESS;
gr2.work_notes = gs.getMessage("The caller did not feel that the incident {0} was resolved", [gr.number+""]);
gr2.update();
return gr2;
}
},
clone: function(id) {
var gr = new GlideRecord("incident");
if (!gr.get(id))
return null;
var gr2 = new GlideRecord("incident");
gr2.initialize();
for (var i = 0; i < IncidentSNC.CLONE_FIELDS_ON_REOPEN.length; i++) {
var field = IncidentSNC.CLONE_FIELDS_ON_REOPEN[i];
gr2.setValue(field, gr.getValue(field));
}
return gr2.insert();
},
type: 'IncidentSNC'
};
IncidentSNC.DEFAULT_CLONE_FIELDS = "additional_assignee_list,assignment_group,business_service,caller_id,category,cmdb_ci,company,description,group_list,impact,knowledge,location,parent,parent_incident,priority,problem_id,rfc,severity,short_description,subcategory,urgency,watch_list";
IncidentSNC.CLONE_FIELDS_ON_REOPEN = gs.getProperty("com.snc.incident.clone_fields_on_reopen", IncidentSNC.DEFAULT_CLONE_FIELDS).split(",");
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2020 09:02 AM
Hi,
Here is the official documentation on how to edit those, if you need to: https://docs.servicenow.com/bundle/paris-it-service-management/page/product/it-service-management/re...
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-14-2020 09:02 AM
Hi,
Here is the official documentation on how to edit those, if you need to: https://docs.servicenow.com/bundle/paris-it-service-management/page/product/it-service-management/re...
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!