- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-29-2022 06:44 AM
Hi
please let me know the code
All resolved Incident tickets of last month will get auto closed on every 1st of current month.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-29-2022 07:02 AM
Hi,
can be easily done using flow designer
1) Flow triggers on 1st of every month
2) checks which incidents are resolved on last month
3) Iterate those and close by setting the state and any other mandatory fields
Remember to save and Activate the flow
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-29-2022 06:52 AM
Hi,
Create a schedule job like below..
Sharing the code as well
var gr = new GlideRecord('incident');
gr.addEncodedQuery('sys_updated_onONLast month@javascript:gs.beginningOfLastMonth()@javascript:gs.endOfLastMonth()^state=6');
gr.query();
while (gr.next()) {
gr.state = '7'; //mention your closed state number;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-29-2022 06:55 AM
Hi charan,
try this in schedule job
var gr = new GlideRecord('incident');
gr.addEncodedQuery('state=6^resolved_atONlastmonth@javascript:gs.beginningOfLastMonth()@javascript: gs.endOfLastMonth()');
gr.Query();
while(gr.next())
{
gr.state='7';
gr.work_notes='Close all the resolved incident through Scheduled Job Script';
gs.log('Demo schedule Job executed');
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā03-29-2022 07:02 AM
Hi,
can be easily done using flow designer
1) Flow triggers on 1st of every month
2) checks which incidents are resolved on last month
3) Iterate those and close by setting the state and any other mandatory fields
Remember to save and Activate the flow
Regards
Ankur
Ankur
⨠Certified Technical Architect || ⨠9x ServiceNow MVP || ⨠ServiceNow Community Leader