- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2025 08:29 AM
Hi,
So the requirement is that if a change (type=normal model) is in state = authorize ,but has a planned start date in the past then it should revert to new.
I have made a model state transition for authorize to new, with transition condition being planned start date is relative before 0 minutes ago
but when I make the change request and set a planned start date at let's say 4:30 p.m. today and end date at 4:31p.m. today then it does not go back to new until 4:35pm today. So it seems to work but the change goes back to new after 5 minutes.
I have made scheduled job which runs periodically at 5 minutes with the following script:
(function execute(inputs, outputs) {
var gr = new GlideRecord('change_request');
gr.addQuery('type', 'model'); //change requests of type model
gr.addQuery('state', -3); // state=authorize
gr.addQuery('start_date', '<', gs.nowDateTime());
gr.query();
while (gr.next()) {
gr.state = -5; // state=new
gr.setwork_notes = 'Automatically reverted to New because Planned Start Date was in the past.';
gr.update();
}
})();
and that is doing the same thing that it will revert the change to new 5 minutes after the planned start date is in the past.
Why is this happening? What do I need to do, so that it reverts to new within 1 or 2 minutes after planned start date has passed?
Thanks.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2025 09:25 AM
The biggest problem with this requirement is that nothing is triggering the state model check when the time passes the start date. The only way to have something happen at the moment a time passes a certain point would be to start a Flow when it hits that state and then wait until it reaches the start time or the start time changes. Then have it do a state model check.
With that said, I think a better process would be to have the submitter change the start time after it's approved if that is needed. Reverting it back to New means you have to cancel the approval request that has been sent and create a notification to let the submitter know it's been reverted. Then the submitter has to go in and request approval again. This could really slow down the change approval process, in my opinion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2025 01:53 AM
Thrn @snow_beginner
I told you flow was the easiest thing to do this. But since you were implementing it other way I also suggested a BR - now this BR is not working single handedly - it needs event triggered with scheduled job to work properly.
Flow was always best.
Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for the efforts and also move this questions from unsolved to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeEISQCY

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2025 09:25 AM
The biggest problem with this requirement is that nothing is triggering the state model check when the time passes the start date. The only way to have something happen at the moment a time passes a certain point would be to start a Flow when it hits that state and then wait until it reaches the start time or the start time changes. Then have it do a state model check.
With that said, I think a better process would be to have the submitter change the start time after it's approved if that is needed. Reverting it back to New means you have to cancel the approval request that has been sent and create a notification to let the submitter know it's been reverted. Then the submitter has to go in and request approval again. This could really slow down the change approval process, in my opinion.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2025 10:03 AM
Hi @JenniferRah
No, "revert to new" doesn't mean canceling the change. It means that all approvals will be moved back to the canceled state. The user will then need to upload the details again, along with the date/time, and request the change, going through the entire life cycle again.
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]
****************************************************************************************************************

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-31-2025 10:21 AM
@Dr Atul G- LNG I realize that won't cancel the change. I was talking about cancelling the approval request that was already sent.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-01-2025 01:51 AM
Hi @JenniferRah you are correct a flow is the best option here and that is what I have used. I have built on your suggestion so its not checking the state transition model, but rather waiting until the planned start date is reached and if it passes then it changes it back to new. Thanks for the idea.