Trigger Flow to run 5 minutes before the planned start date

Dazler
Mega Sage

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.

 

3 REPLIES 3

CMDB Whisperer
Mega Sage
Mega Sage

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.

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.  

Hitoshi Ozawa
Giga Sage
Giga Sage

Haven't tried this yet but this may work.

  1. Create a business rule on Change Request to create a scheduled job that will run 5 minutes before the planned start date.
  2. 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...