- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2023 02:08 AM
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.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2023 05:11 AM
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();
}
mark the solution as correct and helpful if it solves your issue.
Regards,
Kalyan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2023 05:11 AM
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();
}
mark the solution as correct and helpful if it solves your issue.
Regards,
Kalyan
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-20-2023 03:58 AM
Go through the autoclose incident business rule. You will understand what to change, why to change, where to change