Auto close Requested Items
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2013 03:34 AM
I am trying to create a Business Rule that auto closes Requested Items (we ignore Requests) if they have not been updated whilst in a Resolved state for 5 days. There is a BR for Incidents which works fine, using the System Property 'glide.ui.autoclose.time'. I tried to recreate this script for ReqItems but it just doesn't work. Here is the code:
// This script automatically closes request items that are resolved
// and haven't been updated in the specified number of days.
autoCloseReqItems();
function autoCloseReqItems() {
var ps = gs.getProperty('glide.ui.autoclose.time');
var pn = parseInt(ps);
if (pn > 0) {
var gr = new GlideRecord('sc_req_item');
gr.addQuery('state', '4');
gr.addQuery('u_review_required', 'false');
gr.addQuery('sys_updated_on', '<', gs.daysAgoStart(pn));
gr.query();
while(gr.next()) {
gr.state = '3';
gr.comments = 'Request automatically closed after ' + pn + ' days in the Resolved state.';
gr.active = false;
gr.update();
}
}
}
Any ideas why this doesn't work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-27-2013 10:07 PM
Yes, there must be a scheduled job which should trigger this BR.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-28-2013 02:00 AM
Thank you both, that has worked a treat! Great response as always, thanks.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-05-2018 08:16 AM
What do I need to do to auto close if they have not been approved?