Need to Auto close the ticket from resolved to closed after 7 days

Shweta Kasbe1
Tera Contributor

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();
}

10 REPLIES 10

Vishnu Prasad K
Giga Guru

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.