Id like to run a flow every 5 minutes to see if there is a problem with a service, and send an email if something is wrong.
But i dont want to send an email every 5 minutes, rather every hour, say. (to avoid dumping stuff into my inbox)
Within a flow, is there a way to check if previous runs of that flow sent an email, or took a particular logic branch?
The short answer is no - information from previous runs is not available. A work around might be to log the info to a SharePoint list and refer to it when necessary. You could retrieve the most recent entry.
Please note that Flows can run for a maximum of 30 days.
@ashim you could create a flow that runs predefined for a whole hour and only sends the notification at the end of the hour (or even predefine the flow for the whole day).
for the hour approach:
- create a variable I_counter (integer) and set initial value to 12 ... variable - initialize
- create a variable S_Status (string) and set it to utcnow() ... variable - initialize
- Add a do until loop and check if i_counter is 0
- put inside the loop
> your check
> append the result of the check (ok or issue) to S_status, followed by a comma .... variable - append to a string
> set I_counter to current value -1 ... Variable - set variable - expression sub(I_counter,1) (*)
- after the loop add a condition @that checks ifS_status contains Issue ( or decide to send the email anyway)
- in yes branch put
send email or send email notification and have in the body S_status
For the whole day you would need a second counter I_day that counts down from 24, a second do until loop and add after the condition 2 actions
- the first one resets I_counter to 12 ... variable - set variable
- and the second resets S_status to blank ... variable - set variable
(*j you need to use intermediate step and assign current value of I_counter to a temp value. I use data operation - compose for that purpose
The function to check if previous runs of that flow sent an email, or took a particular logic branch is not supported in microsoft flow currently.
I afraid that there is no way to achieve your needs in Microsoft Flow currently.
If you would like this feature to be added in Microsoft Flow, please submit an idea to Flow Ideas Forum:
Three Super User rank tiers have been launched!
Features releasing from October 2020 through March 2021
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!