Sometime you have to wait in Flow
Traffic light

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.

Brainless repeat

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.

Traffic light on red

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.

slip road

Scheduled

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!

Bridge Closed

That’s enough traffic! Time to look at Flow and waiting options.

Scheduled Flows

Scheduled

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.

Flic Button with Flow logo

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.

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
  • Delay Until
Schedule

Delay

The Delay action will let your flow wait for a set amount of time before it continues with the next step.

Delay action

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.

Delay Until

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.

Delay until comment

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

addSeconds(utcNow(),10,’yyyy-MM-ddThh:mmZ’)

Add seconds
 
And my Delay until simply works:
10 seconds done

If you use any different format will will find that the Delay until fails. If I use the following expression:

addSeconds(utcNow(),10,’yyyy-MM-dd hh:mm’)
Then I will see the following error
delay failed

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.

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications Microsoft MVP working as the Head of Power Platform at Vantage 365. You can contact me using contact@sharepains.com

2 thoughts on “Power Automate – Sometimes you just have to wait”
  1. How to get the date of the next upcoming day of the week.
    Choose a day of the week, ex: 5 for Friday, and get the date of the next Friday starting from utcnow().

    https://powerusers.microsoft.com/t5/Power-Automate-Cookbook/Date-of-Next-Chosen-Day-of-Week/td-p/146

    I often see requests for timing things a certain time on a certain day of the week and people respond with an expression formula for that person’s requested day of the week and only their requested day of the week. With this, we shouldn’t need to find a different formula for each day.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Discover more from SharePains by Microsoft MVP Pieter Veenstra

Subscribe now to keep reading and get access to the full archive.

Continue reading