logo

NJP

INCIDENT:: Auto close configuration

Import · Aug 01, 2019 · article

INCIDENT:: Auto close configuration

Image Description
image 01. >> Incident > Administration > Incident Properties
image 02. Number of days (integer) after which Resolved incidents are automatically closed. Zero (0) disables this feature. (glide.ui.autoclose.time) and enter the number of days.
image 03. >>System Scheduler > Scheduled Jobs.
image 04. Search and Open the Autoclose Incidents schedule
image 05.
image 06. >> System Definition > Business Rules
image 07. Search by "Incident autoclose"
image 08. This script will run accordingly property.

08. Original Script

// 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);
        }
        gr.query();
        while(gr.next()) {
            gr.incident_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();
        }
    }
}

Escrito inicialmente para Release Madrid

image

Summary

Configure incidents to close automatically - Oficial documentation

Artigos-publicados

Direct LINKs:

Step: 2

https://.service-now.com/nav_to.do?uri=%2Fsystem_properties_ui.do%3Fsysparm_title%3DIncident%2520Management%2520Properties%26sysparm_category%3DIncident%2520closure,%2520Incident%2520Re-open,%2520Copy%2520Incident%2520and%2520Create%2520Child%2520Incident,%2520Incident%2520Form%2520Fields%2520Configuration

step 8

https://.service-now.com/nav_to.do?uri=%2Fsys_script.do%3Fsys_id%3Dd67b8d9ec0a80118008cd8f0f7f92fae%26sysparm_record_target%3Dsys_script%26sysparm_record_row%3D1%26sysparm_record_rows%3D1%26sysparm_record_list%3DnameSTARTSWITHincident%2Bautoclose%255EORDERBYname

View original source

https://www.servicenow.com/community/itsm-articles/incident-auto-close-configuration/ta-p/2302132