Skip to content

Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Problems
  • Triggers
  • Application specific solutions
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Resources
Menu

Send multiple SharePoint reminders in a single Power Automate flow

Posted on June 9, 2021June 9, 2021 by Tom

“Can I send multiple reminders months/weeks/days before a date with a single Power Automate flow, without repeating the actions?”


When you build a reminder flow, you define also timing of the reminder. Should it send the reminder a month, a week, a day before, or at the date? Each such reminder will need its own Filter Query to calculate if “today” is the date. But what if it’s not a single reminder, but multiple reminders when the date approaches? First reminder 2 months before the date, then 1 month, 2 weeks, 1 week, 2 days, etc…? You don’t want to build the same reminder flow over and over again, changing only the Filter Query. And you don’t have to.

Create an array with configuration

Instead of repeating all the actions, you can have them only once in the flow inside ‘Apply to each’ and change only their configuration. This approach uses the standard array functionality: if you have an array, you can process all the items inside one by one. And in this solution the items represent each of the reminder periods.

Let’s build a fancy reminder flow, where each reminder will have it’s own message and it’ll use the real time period (not a fixed number of days). The first step is to initialize an array variable with the configuration in the format below. Each reminder will have defined the time period, amount of that time period, and the reminder text, e.g.

[
  {
    "Period": "Month",
    "Number": "2",
    "Desc": "in 2 months"
  },
  {
    "Period": "Week",
    "Number": "1",
    "Desc": "in a week"
  },
  {
  ...
  }
]

Since it should use the actual time period, the solution will use addToTime(…) expression. The allowed periods for addToTime(…) are Second, Minute, Hour, Day, Week, Month or Year.

Loop through the array

Once the array is ready, you’ll loop through it to process the reminder periods one by one. Add ‘Apply to each’ to the flow and select the variable as the input, and then add ‘Get items’ inside.

And here comes the most complicated part of the solution, to build the dynamic Filter Query. Power Automate will show you the ‘Current item’ from the array as a dynamic content, but you can’t use it directly.

You could do that if the variable was initialized as a simple array, e.g. [“1″,”2″,”3”], but in this solution the array contains objects. Using ‘Current item’ would give you the whole object, e.g. {“Period”: “Month”,”Number”: “2”,”Desc”: “in 2 months”}. That’d be never equal to a date column.

You’ll need to manually enter the specific values in the object. In the same way as when processing JSON, you’ll access them using the item()?[‘key’] expression.

item()?['Period'] will give you the currently processed period
item()?['Number'] will give you the currently processed number
item()?['Desc'] will give you the currently processed description

With this knowledge you can build the Filter Query to filter the specific time period in each loop. As already mentioned, use the addToTime(…) expression on the right side.

addToTime([Date], [number], '[units]', '[format]')

replacing the parameters with the actual expressions:
addToTime(utcNow(), int(item()?['Number']), item()?['Period'], 'yyyy-MM-dd')

it'll calculate a date 2 months from today in the first loop:
addToTime(utcNow(), 2, 'Month', 'yyyy-MM-dd')
Power Automate multiple reminders single flow

The output of ‘Get items’ in each loop will be only the items for the specific reminder. You can take them, use the description from the array, format the data in an HTML table and send them in an email. Or group the items together to send each user only one email.

Summary

The concepts in this post are not limited to this single Power Automate flow to send multiple reminders. The main idea is that you shouldn’t repeat actions in your flow unless it’s necessary. If you repeat the same action, only with slightly different configuration, consider using some configuration array and the ‘Apply to each’.

The configuration can be an array inside the flow (if it’s fixed) or e.g. a SharePoint list. And it doesn’t have to be an array of object as in this post. If you decide to use reminders based on number of days, you can have just a single array with the numbers to loop through and use the addDays(…) expression instead.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

2 thoughts on “Send multiple SharePoint reminders in a single Power Automate flow”

  1. Amr says:
    April 25, 2022 at 9:45 am

    Thanks for the very useful post .
    I beed your help please, I have a flow for reminder but I was asking if I want to get 2 reminder, one fixed reminder before the due date with one day ” Already done ” . The other reminder i want it to be based on the notifcation period column .
    Any help please ?

    Reply
    1. Tom says:
      May 3, 2022 at 7:31 pm

      Hello Amr,
      I’d probably add one more column to store how many days are the period, and another flow that would convert the period into days, e.g. if users select ‘Month’, the flow would update number 30 in the new column. You can then use this new column to find the items.

      Reply

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Now available:

The Ultimate Power Automate expressions cheat sheet
Equip yourself with the tool to translate your thoughts into Power Automate expressions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Hello and welcome!

My name is Tom and I'm a business process automation consultant and Microsoft MVP living in the Czech Republic. I’ve been working with Microsoft technologies for almost 10 years, currently using mainly Power Automate, SharePoint, Teams, and the other M365 tools.

I believe that everyone can automate part of their work with the Power Automate platform. You can achieve a lot by "clicking" the flows in the designer, but you can achieve much more if you add a bit of coding knowledge. And that's what this blog is about.

To make the step from no-code Power Automate flows to low-code flows: using basic coding knowledge to build more complex yet more efficient flows to automate more of your daily tasks.

  • Format results of date calculation in SharePoint columnJune 29, 2022
  • Why is your Power Automate flow creating duplicatesJune 26, 2022
  • How to create a unique identifier in your Power Automate flowJune 22, 2022
  • How to assign custom SharePoint permission level with Power AutomateJune 19, 2022
  • Remove permissions from a specific SharePoint user with Power AutomateJune 15, 2022

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

© 2022 Let's POWER Automate | Powered by Superbs Personal Blog theme