Need to Auto close the ticket from resolved to closed after 7 days
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-01-2022 11:03 PM
Need to Auto close the ticket from resolved to closed after 7 days.I have written a scheduled job script but its not working. Pls help me in this.
var query = 'state=8^sys_updated_onRELATIVELT@dayofweek@ago@7'; //state is resolved
var gr = new GlideRecord('sc_task');
gr.addEncodedQuery(query);
gr.query();while(gr.next()){
gr.state = '3'; //set the state to closed
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-02-2022 12:01 AM
Hi Shweta,
Usually for sc_task we won't be having resolved state. And if you have customized the state values, then check for any state models on sc_task table.
If it's on incident table, you shouldn't be writing any scripts, just update the property to the number of days required for auto closure and that will do the job.