I am creating a triggered flow that should be restricted from running more than once per day.
Our IT team sends out an email that reports on several systems' load status, and when the systems I am concerned with are all flagged [complete] my flow kicks off a number of reports in PowerBI.
However, the status email continues to circulate, and the flow is triggered on every subsequent message. This creates lots of unnecessary refreshes. I'd like to in a limiter to keep the flow from executing more than once a day. I discovered 'delay until' and wondered whether, after successfully requesting the PowerBI report refresh, I could 'delay until' midnight and prevent further executions on the current day.
Is this an effecient or appropriate solution? Is there some other way to disable a flow after execution and reenable starting midnight tomorrow morning? I suppose I could also keep a log file somewhere and try to write out a history of some kind and then refer to the log to determine if the flow has already run in a day. But I'm hoping to keep the flow more or less self-contained and not use any other files for tracking.
Hi @RCB you can use a Recurrence schedule and set it to run once a day at whatever time you select in your time zone.
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.
Thanks, @RobElliott for your reply.
Unfortunately, a regularly scheduled report is not sufficient. The reports must be run as soon as the data is available, and that is the purpose of setting up a triggered flow. Otherwise, PowerBI could run a refresh on a dialy schedule all on its own.
The status email can be circulated many times before and after all relevant systems are completely loaded. The goal is to trigger the flow on the first and only the first time the email meets all requirements.
While I don't have a full understanding of your requirement, I don't believe that a delay until will work for you. The delay until will stop a given instance of a Flow form proceeding, it will not stop additional instances of the Flow from being triggered.
I believe that you'll need to store the date/time of when the Flow executed somewhere (SharePoint?). When the Flow starts, check the date/time that the Flow last ran. Use a condition and if the Flow should not proceed, use a control terminate action (with success) to exit the Flow. If the Flow should proceed, update the date/time that the Flow last ran.
As Scott has already pointed out, a delay until will not work in your scenario.
If you want to keep your Flow completely self contained then what you can do is make use of the Flow Management actions to turn Flows on and off. https://docs.microsoft.com/en-us/connectors/flowmanagement/#turn-off-flow
In your Flow that is triggered, add a final action that uses the Flow Management connector to turn itself off. This will prevent any further triggers being actioned.
In addition to this, create a seperate Flow that runs daily (using the recurrence trigger) at a specified time (midnight for example) that uses the Flow Management connector to turn the Flow back on again.
This should ensure that it only ever runs once per day and you won't need to store/maintain values in any other external locations.