- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 02:18 AM
Hi,
I need to set a rule for auto closing RITMs after 3 days of resolving. Below is the BR i am using. Please let me know why is it not working.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 03:20 AM
Hi,
Have you created the schedule job to trigger your script?
Like below:
Navigate to sys_trigger table list and search for Autoclose Incident job.
replace name of your BR in the Job Context.
Thanks
Anil Lande

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 02:26 AM
Hi,
Have you created a schedule job to run daily?
Check the configurations for incident auto close functionality.
Update your script as given below:
function autoCloseRequest() {
var ps = gs.getProperty('glide.ui.autoclose.time'); // property value set to 3
var pn = parseInt(ps);
var queryTime = new GlideDateTime();
queryTime.addDaysUTC(-pn);
if (pn > 0) {
var gr = new GlideRecord('sc_req_item');
gr.addQuery('state', '10');
gr.addQuery('sys_updated_on', '<', queryTime);
gr.addQuery('u_coh', 'false');
gr.query(); // this line was missing
while (gr.next()) {
gr.state = '50';
gr.comments = 'Request ditutup otomatis setelah ' + pn + ' hari dari tiket diselesaikan.';
gr.active = false;
gr.update();
}
}
}
})(current, previous);
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 03:12 AM
Hi Anil,
Thanks for your response. I edited the code as given by you but it's still not working.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-03-2024 03:20 AM
Hi,
Have you created the schedule job to trigger your script?
Like below:
Navigate to sys_trigger table list and search for Autoclose Incident job.
replace name of your BR in the Job Context.
Thanks
Anil Lande
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-05-2024 02:18 AM
Hi Anil,
Thanks for the help. I was not creating scheduled job correctly.