2351 views

Customizing incident auto-closure 

 

Overview
In the base system, Incident Management automatically closes incidents 1 day after they have been resolved if no updates are made to the incident. This helps incident closure by automating the Resolved -> Closed state transition. If the record is updated on any field, then the 1 day counter is reset to the last updated timestamp.
 
Customizing auto-closure
There are several ways this behavior can be modified. For any of these modifications, an admin role is necessary:
  • Turn Auto-Closure off
  • Change the number of days to wait before closing the incident
  • Change the frequency at which the system checks on the resolved incidents to close them (default is hourly)
  • Set a specific user as the Updated by on the incident record
  • Hook in other changes on the incident record at the time of closure (for example, add notes in Work notes)
Turning auto-closure off
  1. Navigate to System Properties > System.
  2. Locate the property Number of days (integer) after which Resolved incidents are automatically closed.
  3. Set the Value to 0.

 

Changing the number of days to wait before closing the incident

  1. Navigate to System Properties > System.
  2. Locate the property Number of days (integer) after which Resolved incidents are automatically closed.
  3. Set the Value to be the number of days to wait before closing a resolved incident.
    For example, if you want to wait a week before closing the incident, set the value to 7 days.

 

Changing the frequency at which the system checks on the resolved incidents to close them

  1. Navigate to System Scheduler > Scheduled Jobs > Today's Scheduled Jobs.
  2. Locate the record named Autoclose Incidents.
    This job runs every hour. If there are any new incidents that have gone past the 1 day in Resolved state in that last hour, the incidents are updated.
  3. Update the Repeat time to change this to run at a different frequency. If there is a time of the day you would like it to run, change the Trigger Type to be Daily and set a specific time.

 

Set a specific user as the Updated by on the incident record

  1. Navigate to System Scheduler > Scheduled Jobs > Today's Scheduled Jobs.
  2. Locate the record named Autoclose Incidents.
  3. In the Job content, add the following line above the scScriptName:

    fcRunAs=itil

    (The underlined text must a valid user_id.)

    This ensures all incidents closed as a result of this script are recorded as been updated by ITIL user. You can set this to be any user in your system. 

 

Hook in other changes on the incident record at the time of closure

  1. Navigate to System Definition > Business Rules.
  2. Locate the record named Incident autoclose.
  3. In the the Advanced section, the script field contains the code that runs on every incident closed using this feature. This is where additional changes can be made to the incident record. For example, add a comment in the comments section of the incident documenting the auto-closure. See the commented lines below for an example of adding info in the comments field.


     

    Note: If you edit the script, the script is excluded from future upgrades.

     

 
Technical components of incident auto-close
Note: This section contains advanced user information. Please try the customizations explained in the section above if you are not an advanced user.

 

There are 3 pieces of configuration points that make up the auto-close behavior.

Property

The property glide.ui.autoclose.time is used to determine the number of days after a "silent" resolved incident is closed. A "silent" record is a record that has not been updated on any fields. Any update resets the record so that its auto-closure is measured from last updated timestamp.

This record is located at /sys_properties.do?sys_id=d5c26446c0a8011800cdf450892cec2d.

Business Rule

Incident autoclose contains all the code necessary to do the closure. This includes the query for all the incidents in resolved state and a query of all incidents that have not been updated for longer than the "autoclose days." The business rule also sets a few values:

  • The value in closed_by field to be the same as resolved_by
  • Value in the state field to be closed
  • Active to be set to false

This record is located at /sys_script.do?sys_id=d67b8d9ec0a80118008cd8f0f7f92fae.

Scheduled job

Autoclose Incidents calls the business rule every hour to actively search for "silent" resolved incidents. The job is auto-queued to run every hour by default. This job is normally quite quick and does not create excessive strain on the incstance. If you have an extremely high volume of incidents being moved into resolved state, then you may change this to run at a lower frequency or even once a day only.

This record is located at /sys_trigger.do?sys_id=d67e98dac0a8011801393f5054790aa5.

Article Information

Last Updated:2016-03-31 16:36:28
Published:2015-11-09