- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2016 07:47 AM
Hello,
My high priority incidents that have been resolved are supposed to auto-close after a certain amount of time, but they are remaining in a state of 'Resolved'.
I am familiar with the system properties page that autocloses incidents as well as the auto-close business rule, however the OOB script purposely does not query as I have copied : gr.addQuery('priority','NOT IN','1,2'); I need my higher-priority resolved incidents to auto-close at a different time from the lower priority incidents. This is only dealing with resolved incidents overall.
Thanks in advance ,
Cliff
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-03-2017 06:11 AM
Hi,
Try the following solution:
Create a new system property for the high priority incidents and put the value of the system property on "Days" not "Hours".
Create a new business with the same script as the OOB BR and just put the name of your newly created system property.
Edit the old BR whith a condition on the priority of the incident
Now create a new "Schedule Item" similar to the OOB "Autoclose Incidents" containing the name of your new BR.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2016 09:40 AM
Cliff, there are a number of things in your script..
The first thing is that your call to the schedule api doesn't have anything to do with your GlideRecord query...
However the reason your GlideRecord query is not working is because you cannot say "gr.addQuery('priority','1,2')"
There are a number of ways you can do this but I'm pushing it over to you to figure out!
Let me know if you want me to help you out further!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-27-2016 11:27 AM
I am not familiar, and have not used the schedule api whatsoever so far and I am trying to learn that currently, so Im not sure where to go with that . I have been looking at it since I last replied. For the query, I think I can do: gr.addQuery('priority','IN','1,2')". I have been playing around with a Business Rule. If you could give me some advice on what to seek that would be great.
Thanks again
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-28-2016 08:51 AM
Does anyone have any suggestions or directions I should be looking at? It would be very much appreciated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-29-2016 10:31 AM
I can certainly help you out here. I have few questions though. You are not assigning limit any value but you are checking for limit >125? Is the the full script?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-30-2016 07:28 AM
I am missing some logic here, thank you for the reply Abhinay. I am trying to have this run only when resolved priority =1 incidents are older than 125 hours.
I am also working on a different script, as I am unsure. This is my other script:
// automatically close P1/P2 incidents that are resolved
// fpr 14 days or more.
// For other priorities it is set in System Properties.
//var ps = gs.getProperty('glide.ui.autoclose.time');
var OlderIncident = new GlideRecord('incident');
OlderIncident.addQuery('opened_at', '<', gs.daysAgoStart(14));
OlderIncident.addQuery('state', 6);
OlderIncident.addQuery('priority',"IN",'1,2');
- OlderIncident.addQuery('incident_state', '!=', '7');
- OlderIncident.query();
- OlderIncident.setLimit(10);
while (OlderIncident.next()) {
OlderIncident.incident_state = 7;
gr.comments = 'Incident automatically closed after more than 14 resolved days in the Resolved state.';
OlderIncident.update();
}