Trigger Flow to run 5 minutes before the planned start date
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 04:28 PM
Hi,
I have been asked if there was a way to trigger the flow to run 5 minutes before the planned start date field on the Change Request.
Basically, the Change Request will be in Schedule state and they would like that 5 minutes before the planned start date time to trigger the Flow Designer to move to the Implement state.
Because the ticket is being not being created or updated at that time and Flow triggers on updated and created, is there a way to do this?
I could trigger it right when the state moves to Schedule and then put the Flow in a pause state, but I am unsure if that is the best approach. The flow could be paused for days.
Any help would be greatly appreciated.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 05:40 PM
I would just create a scheduled job to run every 5 minutes (or so) and run a query to see if there are any change requests starting in the next five minutes, and if so then trigger the flow programmatically from the scheduled job.
The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-18-2022 06:10 PM
My company wants the implementation task to create 5 minutes before the planned start because our policy allows them to begin any Change implementation 5 minutes earlier. With the schedule job it might miss the change request.
I just wanted to make sure that having the flow opened for several days does not fall in not practicing best practice. I know we can pause workflows and flow, but I just wanted to validate or see if anyone had any similar task and how they accomplished it.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎03-19-2022 06:13 AM
Haven't tried this yet but this may work.
- Create a business rule on Change Request to create a scheduled job that will run 5 minutes before the planned start date.
- In the scheduled job, paste Flow Designer's code snippet to execute the flow.
https://docs.servicenow.com/bundle/sandiego-servicenow-platform/page/administer/flow-designer/task/f...