2019-04-09

Scheduled tasks are one of the most useful elements of many solutions, the ability to carry run a process or processes at set times each day for otherwise manual tasks such as sending out reminders or refreshing data within a system. Traditionally this was done as a Windows Scheduled Task, or in the world of SharePoint on-premises, it could have been done as a SharePoint Timer Job. As society moves more and more to cloud solutions, other options have come to the table such as the ability to schedule Azure Functions, or web jobs before that, to quote just a couple of examples. This has always been within the remit of a developer or administrator to set up, manage and maintain these tasks. Microsoft Flow is now a huge part of the everyday users’ life, so why not empower your users to set up their own scheduled processes using the Recurrence trigger?

Triggers

There are three types of trigger within Microsoft Flow:

  • Manual – a user must do something to fire the Flow e.g. pressing a Flow button or calling the action directly from a SharePoint list.
  • Automatic – the Flow will run based on a Trigger and will run without any explicit user interaction with it e.g. when the user updates an item in SharePoint, the Flow will run. The user has interacted with something other than Flow, however, Flow has then triggered and started its process.
  • Scheduled – a Flow will run based on a schedule, much like our traditional scheduled tasks. This is what we will be looking within this blog post.

Recurrence Trigger

For anything in Flow which you want to schedule, you can use the recurrent trigger. This trigger can be set to run on specific time intervals, as you would expect given the name. Its frequency can be set to run on a Second, Minute, Hour, Day, Week and Month frequency which means that it will cater for pretty much any scenario which you could think of. As Flow is now becoming more and more of an integration platform, as well as process automation, it means that you can schedule the pull or push of data from external data sources, from lists, libraries, Excel spreadsheets, pretty much anywhere.

Recurrence Trigger

The basic trigger itself is really easy to configure, it’s really just a case of adding the interval and setting the frequency. But, for me, the really useful configuration elements of this trigger come when I select “Add new parameter”. This gives me that little bit more control over when my schedule is actually going to run. What I now get is the ability to set:

  • Timezone
  • Start Time

Recurrence trigger with additional parameters

These options exist for all of the different frequencies, however, for me, the excitement starts when we start to look at the Daily and Weekly frequency options.

Daily Frequency

The Day Frequency does what it says on the tin, it allows you to run a Flow each day…but it actually does much more. When you select this frequency, there are two additional parameters which you can now select.

  • At these hours
  • At these minutes

By introducing these additional parameters, I can specify the exact time of day at which my scheduled Flow is going to run. The nice thing about this interface is that I can actually specify multiple times of day for this to run without the needs to duplicate Flows with other Recurrence triggers. So, for example, if I wanted my Flow to only run when I know there are people working, then I could configure it to run at 9, 10, 11, 12, 13, 14, 15, 16, 17. I can also specify the minutes, so I can tell it to fire at 30 minutes past each hour. It will then give you a preview of your timings at the bottom of the Trigger pane.

Recurrence trigger configured for a daily schedule

One thing you’ll notice with the preview, and this sets off my OCD, is that the order of the timings is not chronological, it will display them in the order in which they were selected. If it bothers you as it does me, then you’ll just need to de-select your hours and then select them again in the right order. You should also note that the value you put in the minutes will be applied to all hours i.e. you can’t have one running at 10:30 and then another one running at 11:15.

Weekly Frequency

The weekly frequency is just as configurable as the Daily frequency, as it still gives me “At these hours” and “At these minutes” however it now gives me the option to select “On these days”. Again, for me, this is awesome because I can ensure that my Flow only runs in the working week rather than consuming Flow runs at the weekend when the process may not need to run. The configuration option allows you to specify the days that you want it to run on, whether that is Monday, Wednesday, Friday or if you want it to run every day (why not just use the daily frequency?). 

Recurrence trigger configured for a weekly schedule

How I’m using it

There are so many use cases for this, and the fact that it empowers the citizen developers to actually take responsibility for keeping their own data fresh rather than always relying on their poor IT administrators. But I thought I would share with you one way which I’m using this Trigger to help me out on a daily basis. Twitter is a great way to keep up with the latest news and announcements, especially in the world of Office 365, so I use Flow to help me to pull together some of the tweets which I’m most interested in. This Flow fires every day at 1700 and will give me the 20 latest tweets, either those that are tagged with #MicrosoftFlow or those that Jon Levesque pumps out.

Flow example using recurrence trigger

So that’s an overview of the Recurrence trigger, something which I don’t believe is used enough, certainly in the clients that I’ve worked with, but can add a lot of value to how you create your Flow. It’s not just business purposes, remember that Flow can be used to make your life easier as well, even if it’s something as basic as consolidating some information and sending it to you. The newer additions to the trigger to allow you to select and specify the days and hours that this trigger runs at are particularly useful. So next time you need to create yourself a scheduled task, ask yourself if it’s something which you could more easily manage using Microsoft Flow.

(Visited 759 times, 1 visits today)

About the author 

Matt Weston

Leave a Reply

{"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}

2 Free Ebooks: How to govern Microsoft teams 

Download your 2 free Microsoft Teams governance Ebooks and learn the steps necessary to create a bullet-proof governance strategy.