The CreatorCon Call for Content is officially open! Get started here.

after 5 days Auto close incident those are in resolved state

Abhijeet Pawar
Tera Contributor

Hello All,

I want to automatically close resolved incident after 5 days .how can I achieve this functionality can anyone please guide me on this?

Thank You.

1 ACCEPTED SOLUTION

Hi @Abhijeet Pawar ,

from navigation select scheduled job > click new> select "Automatically run a script of your choosing"
and write the code which you want to check and also remove gr.initilaize() from your code then save and click on Execute now 

for your reference below is the code 

var gr = new GlideRecord("incident");
gr.addQuery('state','6');
gr.query();
while(gr.next()){

gr.state = 7;
gr.close_code = 'Solution provided';
gr.close_notes = 'hello';
gr.active = false;
gs.log("Incident has closed");
gr.update();

}Screenshot 2023-01-20 at 6.40.04 PM.png




mark the solution as correct and helpful if it solves your issue.

 

Regards,

Kalyan

View solution in original post

11 REPLIES 11

Hi @Abhijeet Pawar ,

from navigation select scheduled job > click new> select "Automatically run a script of your choosing"
and write the code which you want to check and also remove gr.initilaize() from your code then save and click on Execute now 

for your reference below is the code 

var gr = new GlideRecord("incident");
gr.addQuery('state','6');
gr.query();
while(gr.next()){

gr.state = 7;
gr.close_code = 'Solution provided';
gr.close_notes = 'hello';
gr.active = false;
gs.log("Incident has closed");
gr.update();

}Screenshot 2023-01-20 at 6.40.04 PM.png




mark the solution as correct and helpful if it solves your issue.

 

Regards,

Kalyan

suvro
Mega Sage

Go through the autoclose incident business rule. You will understand what to change, why to change, where to change