Understanding The Trigger: Recurrence

This blog and video series ‘Understanding The Trigger’ (UTT) is looking at each trigger in the Microsoft Flow workspace. The aim is to understand what they do, how to use them and building an example of them being used to allow us to have a greater understanding of the breadth of uses for Microsoft Flow!

The Trigger

Recurrence is a trigger can be found in the ‘built-in’ trigger category under the ‘Schedule’ section. The trigger is used for scheduling a flow to run over a frequency of seconds, minutes, hours, days, weeks or months from a specified date and time.

Functionality

When first adding the “Recurrence” trigger a.k.a “Schedule” trigger, to a flow you’re presented with two fields ‘Interval’ and ‘Frequency’ with a “Show Advanced Options” button. Clicking this button reveals a multitude of options which we will break down below:

Interval

This takes a numeric value that will signify the amount of occurrences per frequency, for example the image above shows the default value of ‘1’ in the Interval and ‘day’ in the Frequency. This would signify that every ‘1’ ‘day’ we will run the Flow, or in easier English; Everyday we will run our Flow.

Frequency

The frequency takes a drop-down selection from the list below:

  • Second
  • Minute
  • Hour
  • Day – This adds additional advanced options
  • Week – This adds additional advanced options
  • Month

The Interval will set each occurrence in the specified frequency selected that the Flow will run. Lets take a look at some examples of this:

Example 1
Interval: 1
Frequency: Second
Outcome: Every second our Flow will run

Example 2
Interval: 2
Frequency: Minute
Outcome: Every two minutes our Flow will run

Example 3
Interval: 3
Frequency: Month
Outcome: Every three months our Flow will run

Time Zone

This takes the time zone at which you want your schedule to run based on a UTC standard.

Start Time

The start time allows you to specify when you want your Flow intervals and frequency to kick off. This needs to be done in a YEAR – MONTH – DAY T HOUR: MINUTE: SECOND Z format.

On These Days (Week Frequency Only)

This allows you to specify what days they run on, for example, if you specify that every week your flow should run you could then state they should run on a Monday.

At These Hours (Week & Day Frequency Only)

Similarly with week you can then specify the hours that your flow should run, for example, at ’18’ would be a 6PM.

At These Minutes (Week & Day Frequency Only)

Like the hours, we can then set the exact minute we want our Flow to kick off, such as ’15’ would be the 15th minute of the hour for example, at 6:15PM.

Example

As a user I want to use the Microsoft Flow Recurrence trigger to send me a notification to my watch for a weather update everyday at 1PM so I’m ready for what ever the weather conditions are outside in Cambridge, UK, on my lunchtime.

User Story

Firstly, we want to add the Recurrence trigger. This will then provide us with, as we saw previously, the Interval and Frequency. We want to run this daily so we need to ensure that the interval is set to ‘1’ and the frequency is set to ‘day’.

As per the user story, we need to make sure this runs at 13:00 so we need to expand the ‘Advanced Options’ and place a start date and time. As per writing this the start date was this 2019-07-25 with a time start of 12:00; Thus we enter 2019-07-25T12:00:00Z.

We then can set the 13:00 time here by setting ’13’ for the ‘At These Hours’ and ‘0’ for the ‘At These Minutes’. This will run the flow at 13:00 daily.

We’ve now set up the schedule, now we need to get the weather information for Cambridge. To do this, add a ‘Weather’ action and provide the ‘Location’ as Cambridge, UK and the units as ‘Metric’ (as we’re in the UK!)

Now we need to pass that information to the watch. The iWatch needs to be connected to an iPhone that has the Flow app installed. Then we simply pass a mobile notification with the weather information and it will be passed on to the watch.

Demonstration

For this demonstration, I’m going to manually trigger the flow to show you what to expect when the schedule runs each day.