Cancel changes daily if Planned start date is in the past scheduled job
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-15-2024 11:58 PM
Hello Community
I have a requirement to create a daily scheduled job to cancel changed automatically if planned start date is in the past if the state is in Assess/Authorize state.
I have a start to something but need more help please.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 12:09 AM
hi please look below code and also check state value
var gr = new GlideRecord("change_request");
gr.addQuery('state', 'IN', 'Assess,Authorize');
gr.addQuery('active', true);
gr.addQuery('start_date', '<', gs.nowDateTime());
gr.query();
while (gr.next()) {
gr.state = 3;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-16-2024 12:33 AM
Thank you Harish,
I have tried the script in the scheduled job execution but doesn't seem to work yet. I also need to add a work note: The work notes are updated "The system has cancelled this Change as its in the approval phase but the Planned start date is in the past"