- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2022 10:27 AM
Trigger a schedule job at mid night 12 . Schedule job should perform autoclose incidents which are in resolved state from last 5 days(update resolution information and resolution code with this incident auto closed by system due to inactive update from last 5 days).
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2022 10:55 AM
Hi
This happens automatically, default number of days when ServiceNow closes the incident is 7 days.
You just need to update the property to 5 days as per steps mentioned below:
1) Navigate to System properties by typing "sys_properties.LIST" in Application Navigator and hit enter as shown below:
Now search for the property Named as "glide.ui.autoclose.time" and just change the value from 7 to 5 as shown below:
Property Link for reference posted below:
https://instance.service-now.com/nav_to.do?uri=sys_properties.do?sys_id=d5c62446c0a8011800cdf450892cec2d
Replace "instance' with your instance name.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2022 10:39 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2022 10:55 AM
Hi
This happens automatically, default number of days when ServiceNow closes the incident is 7 days.
You just need to update the property to 5 days as per steps mentioned below:
1) Navigate to System properties by typing "sys_properties.LIST" in Application Navigator and hit enter as shown below:
Now search for the property Named as "glide.ui.autoclose.time" and just change the value from 7 to 5 as shown below:
Property Link for reference posted below:
https://instance.service-now.com/nav_to.do?uri=sys_properties.do?sys_id=d5c62446c0a8011800cdf450892cec2d
Replace "instance' with your instance name.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2022 11:00 AM
Hi
Also for knowledge sharing want to add here, how this property works. There is a OOB Business Rule named as "incident autoclose" where this system property shown above gets called and this Business Rule is triggered by a Scheduled Job which is "Autoclose Incidents".
So now if you want to set any field values while Incident gets closed you can set it up in a Business rule mentioned above itself and you do not need any code changes here as shown below:
BR Link:
https://instance.service-now.com/nav_to.do?uri=sys_script.do?sys_id=d67b8d9ec0a80118008cd8f0f7f92fae
Replace "instance' with your instance name.
Screenshot for BR where you can set the fields:
Posting the Scheduled Job URL as well below for reference:
https://instance.service-now.com/nav_to.do?uri=sys_trigger.do?sys_id=d67e98dac0a8011801393f5054790aa5
Replace "instance' with your instance name.
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-06-2022 11:05 AM
Hi
So my suggestion and preferred method would be the above as shown. But still if this is for learning perspective and you want to write your own Scheduled Job then use the script below:
Script:
closeIncident();
function closeIncident(){
var gr = new GlideRecord('incident');
gr.addEncodedQuery('state=6^sys_updated_on<javascript:gs.beginningOfLast5Days()');
gr.query();
while(gr.next()){
gr.state = 7;
gr.close_notes = 'Incident Resovled by system due to inactivity ';
gr.update();
}
}
Screenshot for reference:
Hope this helps. Please mark the answer as correct/helpful based on impact.
Regards,
Shloke
Regards,
Shloke