Auto close resolved incidents after 3 business days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 06:43 AM
Trying to figure out how to auto close an incident after 3 business days of being in resolved state. I tried following link (How to close ticket after 3 business days )however, end date here has the correct date but not correct time. Any one has a solution for that? Appreciate your help!
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 07:32 AM
Hi,
In this case you needs to write scheduled job to check for the resolved tickets to auto-close after 3 business days.
Write the script something like this, please change the code as per your requirement.
Please correct the code, if I missed something in it.
var g = new GlideRecord('incident');
g.addQuery('state', '6');
g.query();
if(g.next())
{
var days = 3;
var startDate = current.resolved_at;
var endDate = gs.now();
var schedule = new GlideSchedule();
schedule.load('090eecae0a0a0b260077e1dfa71da828'); // loads "8-5 weekdays excluding holidays" schedule
var duration = schedule.duration(startDate, endDate);
//gs.info(duration.getDurationValue()); // gets the elapsed time in schedule
if(duration == days)
{
g.state = '7'; // set as closed.
}
}
Thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 08:28 AM
i added a line g.addQuery('number','INC00xxxxx'); right above g.query() to try this for a specific incident but it doesn't work. Does it work for you? Made sure the sys_id was correct for my system.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 11:51 AM
Hi,
Please check this link, this may help you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 07:06 AM
Chuck Tomasi wrote:
This is built in functionality. The system is already set up to auto close after three days.
Unfortunately the built-in functionality uses calendar days, not business days - it doesn't respect availability schedules.
(default is 1 day in Jakarta now, I believe... I was shocked it'd dropped so short!)

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-25-2017 07:55 AM