Sometimes in Flow you just have to wait for a while. There are a few options available that I will look at in this post. Before I dive into Microsoft Flow I will have a look at traffic control systems. Yes that is these traffic lights that are always on red when you are in a hurry.
We all know how traffic lights work. Actually they can work in different ways.
Some traffic lights go from red to green and back to red again and they do that all day long every day. These traffic lights don’t look at the traffic they just repeat the same sequence over and over again.
Press a button
Sometimes you have to press a button on when you want to walk across the road. We all know that you could also just walk across the road and take that risk, but you should press that button.
When someone presses that button you don’t get immediately get to cross the road. You simply tell the traffic light system, please do not skip my turn.
Then after a while it will be your turn and you can safely cross the road.
Every now and then repeating pattern
You might not see these in all countries, but some countries use traffic lights to join the motorway. These lights let through a few cars before they go on red again. The amount of time the green light is shown will depend on the amount of traffic on the road that you are trying to join.
As my last example I’m going to look at a bridge. Boats may want to get past, however when your boat is too tall you will have to wait for one of the scheduled times for the bridge to open. Typically, this could be something like 9am, 12noon and 3pm. So at set times you will be able to get past and if you turn up late well … You miss the boat!
That’s enough traffic! Time to look at Flow and waiting options.
If you want to implement a bridge you could consider using a scheduled workflow. This would probably work ok as you can schedule your flows to run at a regular interval. If you want to create a slightly more clever system then you might want a manual starting flow. Compare this to a person opening the bridge manually for you at the time you turn up.
This could be done by clicking a button. The click of the button would start your flow and that would trigger your steps. Both the button and the scheduled triggers have one thing in common. The start of the event (time or click) is when something needs to happen. But what if you are in the middle of your process and you just need to wait? Then we need to look at pausing flows.
When you want to pause a flow or not run a next step until a certain time you have 2 options. Both options are available as part of the Schedule actions.
- Delay Until
The Delay action will let your flow wait for a set amount of time before it continues with the next step.
If for example you want to wait for 1 hour between sending an email and sending a reminder email then you could use this action. This is a bit like when you press that button when you want to cross the road. You wouldn’t want the traffic lights to switch immediately when you press that button. You have to give the cars on your way some time to stop. That is where the amber light comes in after a short period of time. The delay action can be used to wait for a short set period of time.
The Delay Until action is more like my bridge example. I want to open my bridge at set times. The delay until creates a delay until a certain time.
In the above screenshot the comment might not seem to be too important but actually it is important. Note the format of the date and time.
Using the addseconds function I’m adding 10 seconds to the current time
If you use any different format will will find that the Delay until fails. If I use the following expression:
BadRequest. The ‘timestamp’ value of the ‘Wait’ action ‘until’ inputs must be specified in UTC using the round-trip date/time pattern (for example, ‘2015-10-22T10:00:00Z’). For details please review the Standard Date and Time Format Strings of the .Net framework.
If you decide to use the Delay Until, you might want to use check that the format of the date is correct as you will see the above error message is anything is wrong.