Scheduled Workflows In Microsoft Power Automate

by | Power BI

In some of our past blog posts, we’ve already discussed the automated and instant flow. To recap briefly, the automated flow is based on events, while the instant flow can be triggered manually. For this tutorial, we’ll learn and create scheduled workflows in Power Automate. You can watch the full video of this tutorial at the bottom of this blog.

Flows can be based on time. A scheduled flow is triggered by a time constraint.

For example, we can create a flow that gets triggered at 9:00 AM or on Mondays and Tuesdays of every week, or any specific time, day, or month that we want to set. Hence, the trigger here is not an automated event, like a tweet or a click of a button. It’s time-based (it’s based on 9:00 AM). 

Scheduled workflows

If we click on the scheduled flow, it will display this dialog box where we need to set the starting date and time to run this flow. We also need to set the number of times we want it to repeat.

Scheduled workflows

Keep in mind that when testing scheduled workflows, we don’t need to wait until the trigger action. We can trigger it ourselves – which makes testing a lot easier.

Everything else that we’ve learned about flows applies to this flow type. For example, we can use conditions or add multiple actions to schedule the flow. The only difference is how we’ll trigger it. 

Creating Scheduled Workflows In Power Automate

Let’s start creating a basic scheduled flow. First, let’s change the recurrence to every Month instead of Minute.

Scheduled Workflows

Again, scheduled workflows are based on recurrence. Thus, we don’t want to trigger this flow every minute. We can also change this later on. 

We can also create a flow that only starts on a certain date or after two weeks. We can do that by setting the Starting date and time.

Scheduled Workflows

Then, click the Create button to create this flow.

Scheduled Workflows

As a result, we’ll see that the top of this flow diagram looks different than what we’ve seen before. This is because it’s not based on a button or an automated trigger. Instead, it’s based on recurrence.

Scheduled Workflows

This Recurrence trigger is based on a connector called Schedule. You can see this when adding a new step.

Scheduled Workflows

If we click the Schedule connector, we’ll see the Trigger called Recurrence. And that’s how the initial action of this flow diagram was created.

Scheduled Workflows

Inside this Recurrence trigger, we can specify the Interval and Frequency of the action such as once every month, week, day, etc. For this example, we’ll use Month.

Scheduled Workflows

We also have these fields within the Advanced options where we can set the Time zone and Start time for this flow.

Scheduled Workflows

To further understand scheduled workflows, we’ll create a flow that sends an automatic message every 9:00 AM to our team. Therefore, we’ll connect the Power Automate to our Slack account.

Creating A Recurring Slack Flow

First, let’s add a new step.

Search for the Slack connector and click on it.

As you can see, there are other available actions that we can use here. But for this example, let’s click the Post message action. 

We then need to sign in to our Slack account. So, click the Sign in button.

After signing in, we need to set the Channel Name where we want to post the message, and the Message Text that we want to post.

For this example, we want to post to the tutorial channel on our Slack.

So, let’s choose the tutorial channel for the Channel Name field.

By clicking on the Advanced options, we’ll see the other fields in this Slack action as well. We can choose the name of a bot, post as a specific user, and a lot more.

For now, we just want to post a message. So, let’s type “Good Morning everyone!

Let’s also rename this flow to “Slack Scheduled Flow”. 

Then, click Save.

Testing Scheduled Workflows In Power Automate

Let’s now test the flow.

It’s our first time testing it so we can only use the first option (I’ll perform the trigger action). Then click the Test button.

This is different from manual testing because scheduled workflows are based on time constraints. Therefore, we only need to run it. Let’s click the Run flow button.

Following that, we can check our Slack to see if it ran successfully. As we can see, a new message was posted saying “Good Morning everyone!” This means our flow was successfully executed.

Scheduled Workflows

By doing those steps, we were able to make a very simple Slack bot. With the use of Power Automate, it was easy for us because we can do it visually.

Let’s now make this flow a bit more complex and realistic. First, let’s change the frequency to Day.

Scheduled Workflows

Then, click the Advanced options. On our Post message action, change the Post As User to Yes.

Scheduled Workflows

That will change the username on our automated message in Slack. As we can see here, it’s now using my username instead of the app name (Microsoft Power Platform).

Scheduled Workflows

Adding A Delay To Scheduled Workflows

Next, let’s change the posting time for our message. We’ll set the hour here as 9. With this, our message will always be posted at 9:00 am every day.

Scheduled Workflows

However, if our message is posted at exactly 9:00 AM every day, people will get suspicious and they might think that the one who’s posting is a bot and not an actual person. So, let’s make it run between a range of minutes before or after 9:00 AM. To do that, let’s add another step.

Scheduled Workflows

Use the Schedule connector.

Scheduled Workflows

The Delay Until action is based on a specific event. By using this action, the flow won’t proceed until it gets approval from someone or some event occurs. But we won’t use this for now.

Scheduled Workflows

Instead, we’ll use the Delay action. This lets the flow run but it’ll wait for the seconds, minutes, or time that we’ll set within the action.

Drag this action between the Recurrence trigger and our Post message action.

For the Unit field, let’s choose Minute.

We can set the number of the delay in the Count field. However, if we add a fixed number like 2, we’ll still encounter the same problem because our message will still be posted at exactly 9:02 AM every day.

So, we’ll use an expression instead. We’ll set a random number from 1 to 5. Under the Expression tab, let’s look for the expression called rand. This takes in a minimum and maximum number or integer and generates a number between them.

Inside this rand() expression, let’s use 1 as the minimum and 5 as the maximum number. Then, click the OK button. This will delay our flow to a range of 1 to 5 minutes.

After that, let’s save and test this flow.

Testing The Delay Action

Choose the first option, then click the Test button.

Lastly, click the Run flow button.

As we can see, it used 1 as the random number. Instead of posting the message at exactly 9:00 AM, it will wait for 1 minute after 9:00 AM to post the message. We can also see the countdown of the delay at the top right portion of the Delay action.

After a minute, our message will then be posted to our Slack channel.

Let’s try to test it again to see if the random number will change.

C:\Users\Gel\AppData\Local\Microsoft\Windows\INetCache\Content.Word\15.jpg
C:\Users\Gel\AppData\Local\Microsoft\Windows\INetCache\Content.Word\16.jpg

For this result, it used 4 as the random number. This means that the flow will wait for 4 minutes before posting our message.

And that’s how the Delay action with rand() expression works.

***** Related Links *****
Power Automate Trigger Conditions – An Introduction
Power Automate Expressions – An Introduction
Power Automate Actions | A Deep Dive Tutorial

Conclusion

To sum up, we were able to create some sample scheduled workflows that we can use in our daily activities. We can perform other cool things with this flow such as adding a list of tips that will be posted every morning.

Again, keep in mind that scheduled workflows are just the same thing as instant flows or automated flows. However, they’re based on a specified time instead of being triggered by a button or an event. With this, you can also do tasks or actions that are recurring. 

We can use the Schedule connector to create a recurrence trigger and a delay action, both of which are useful integrations for our workflows. Hopefully, this helps you learn more about scheduled workflows and how they work.

All the best,

Henry

[youtube https://www.youtube.com/watch?v=ukLf1-QnnMk&w=784&h=441]

Related Posts

Understanding Data Models and Visualizations

DAX Table Functions Deep Dive

Explore an in-depth analysis of DAX table functions in Power BI, comparing SUMMARIZE and ADDCOLUMNS, and understanding INTERSECT and EXCEPT for enhanced data manipulation and analysis.