Resolved active incidents
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi,
There are many resolved incidents which are still active for over an year without getting closed. I don't know any other reasons which I have to look out for. Kindly help.
// This script automatically closes incidents that are resolved
// and haven't been updated in the specified number of days.
// This number is a property in System Properties.
// To place a comment in the incident, uncomment the "gr.comments" line.
autoCloseIncidents();
function autoCloseIncidents() {
var ps = gs.getProperty('glide.ui.autoclose.time');
var pn = parseInt(ps);
var queryTime = new GlideDateTime();
queryTime.addDaysUTC(-pn);
if (pn > 0) {
var gr = new GlideRecord('incident');
gr.addQuery('incident_state', IncidentState.RESOLVED);
gr.addQuery('needs_attention',false);
if (gs.getProperty('com.snc.incident.autoclose.basedon.resolved_at', 'false') === 'true') {
gr.addQuery('resolved_at', '<', queryTime);
}
else {
gr.addQuery('sys_updated_on', '<', queryTime);
}
if (pm.isActive('com.snc.incident.mim')) {
var mim = gr.addNullQuery('major_incident_state');
mim.addOrCondition('major_incident_state', '!=', new sn_major_inc_mgmt.MajorIncidentTriggerRulesSNC().MAJOR_INCIDENT_STATE.ACCEPTED);
}
// Exclude OT Incident and its children being affected by this script
if (pm.isActive('com.sn_ot_inc_mgmt')) {
gr.addEncodedQuery('sys_class_nameNOT IN' + new TableUtils('sn_ot_incident').getAllExtensions().toArray().join());
}
gr.query();
while(gr.next()) {
gr.incident_state = IncidentState.CLOSED;
gr.state = IncidentState.CLOSED;
// gr.comments = 'Incident automatically closed after ' + pn + ' days in the Resolved state.';
gr.active = false;
gr.closed_by = gr.resolved_by;
gr.update();
}
}
}
Regards
Suman P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago - last edited 2 hours ago
Hi @ServiceNow Use6 ,
OOB autoclose setting in place for all incidents excepts Major incidents. It is expected feature.
Check if your incidents are major incidents which is not moving from resolved to closed.
Apply small customization as per your requirement move those major incidents from RESOLVED to CLOSED.
refer: https://support.servicenow.com/kb?id=kb_article_view&sysparm_article=KB0785420
(Major incidents are not CLOSED by the system even after 7 days)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hello.
As @Tanushree Maiti already mentioned.
- Major Incidents Excluded: Some systems are configured to exclude "Major Incidents" from automatic closure rules, requiring manual closure.
Verify once incidents are major incidents which is not moving.
Refer below KB-KB0785420
Major incidents are not CLOSED by the system even after 7 days - Support and Troubleshooting
Please mark this response as Helpful & Accept it as solution if it assisted you with your question.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
if those are normal incidents and not major incidents then they should get auto closed based on OOTB logic unless somebody changed that or deactivated that
Also major incidents are not auto closed, manager needs to manually close them
It's clearly mentioned in docs
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
