- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2019 11:39 PM
Hi All,
We have a custom table (u_service_request). We want all the service requests which are in Resolved state to auto-close in 7 days similar to how it happens in Incidents. How can we achieve that?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-18-2019 11:44 PM
Hello User,
Write a Schedule job for this requirement which runs every day
var query = 'state=-4^sys_updated_onRELATIVELT@dayofweek@ago@7'; //state is resolved
var gr = new GlideRecord('table_name');
gr.addEncodedQuery(query);
gr.query();
while(gr.next()){
gr.state = '3'; //set the state to closed
gr.update();
}
Mark the answer as correct and helpful if it helped you..!!
Regards,
Chalan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2019 12:19 AM
I did follow it, do I need to create new properties or can we use the same ones?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-19-2019 05:48 AM
Hi,
You have to create one schedule also to trigger the newly created business rule also.
Regards,
Munender