How to Disable Automatic Incident Resolution for OK Severity Alerts in ServiceNow?

SathishB
Tera Contributor

If the alert severity is OK, the respective incident resolves automatically. For learning purposes, I need to deactivate that process. I checked the Flow, Alert Management Rule, Business Rule, and Scheduled Jobs, but I couldn't find where to disable it. Does anyone know the name of the Business Rule, Alert Management Rule, or Scheduled Job? Also, in that Scheduled Job, which Script Include is being used?

7 REPLIES 7

Arun_Manoj
Mega Sage

Hi @SathishB,

Please refer to the following link from ServiceNow documentation:

🔗 Configure Incident Auto-Close – ServiceNow

If you find the solution helpful, kindly mark it as Helpful.

Thanks!

Still, I can’t find the solution

GlideFather
Tera Patron

Hi @SathishB 

 

check this business rule "incident autoclose" on [incident] table:

KamilT_0-1753029741843.png

 

// 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);
		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();
		}
	}
}
———
/* If my response wasn’t a total disaster ↙️ drop a Kudos or Accept as Solution ↘️ Cheers! */


Still, I can’t find that option in this business rule. I guess I need to look for it in some other process.