- 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
03-31-2025 09:09 AM
Hello @snow_beginner
Why did you create a scheduled job with 5 mins periodically ? The state transition conditions weren't working ?
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 02:22 PM
Hi @Shivalika @yes what I noticed with the state transition was that it was not going back to new if the planned start date was in the past. So I made the the transition condition inactive and created the scheduled job but in both cases changes are going back to new but after 5 minutes has passed the the planned start date.
I think what’s required is that it reverts to new sooner than that.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-31-2025 02:36 PM
Hello @snow_beginner
Then there's a solution, create a BR which runs in update on this table and conditions is "planned_start_date <gs.nowDateTime()" and whatever other conditions you want to add. Then set the state back to new.
Please confirm if you checked my answer. Kindly mark my answer as helpful and accept solution if it helped you in anyway. This will help me be recognized for my efforts and also it can move from unsolved bucket to solved bucket.
Regards,
Shivalika
My LinkedIn - https://www.linkedin.com/in/shivalika-gupta-540346194
My youtube - https://youtube.com/playlist?list=PLsHuNzTdkE5Cn4PyS7HdV0Vg8JsfdgQlA&si=0WynLcOwNeE
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2025 01:49 AM
Hi @Shivalika no a business rule won't be sufficient because this needs to still work after the record has been saved. So if I set a planned start date at 2pm today for example and make the change go through the states (new, assess) and when it reaches authorize, I don't action the approvals so it stays in authorize state at 2:00 pm, so in that case it needs to go back to new. I have figured that we have to use a flow.