How to Close Problem Records automatically after 5 days ???
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2022 08:56 AM
Hey Community,
I want to auto-close the problem records that are resolved after 5 days. I have so far followed below steps :
1. Created a Business Rule with below script :
// This script automatically closes problems 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..
autoCloseProblems();
function autoCloseProblems() {
var ps = gs.getProperty('glide.ui.autocloseproblem.time');
var pn = parseInt(ps);
var queryTime = new GlideDateTime();
queryTime.addDaysUTC(-pn);
if (pn > 0) {
var gr = new GlideRecord('problem');
gr.addQuery('state', 6);
// gr.addQuery('sys_updated_on', '<', queryTime);
gr.addQuery('sys_updated_on', ''<'', gs.daysAgo(pn));
gr.query();
while(gr.next()) {
gr.state = 7;
// gr.comments = 'Problem automatically closed after ' + pn + ' days in the Resolved state.';
gr.active = false;
gr.closed_by = gr.resolved_by;
gr.update();
}
}
}
2. Created a Schedule Item
3. Created a system property : glide.ui.autocloseproblem.time
I tried adding 1 min as trigger as well as 1 hour trigger in schedule item. But still above configuration is not working. Kindly let me know what am I doing wrong ??
As I see we do have OOTB for Incidents autoclosure but not for problems. Please help me with the requirement.
Thanks,
Hritik
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-20-2022 09:15 AM
Hi,
Use this thread for your help :
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 05:27 AM
Hi Sandeep,
I used the same thread for creating above configurations. But no luck ! 😞
Thanks,
Hritik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-21-2022 05:54 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-05-2022 04:35 AM
Requirement achieved. thanks community