|Summary:||This article provides step by step instructions on how to create a run once daily trigger using Power Automate.|
|Related Product(s):||This article relates to the following products:|
You have a
triggered action that you wish to alert a user about. However, you only want to
alert them the first time the action happens every day. You do not know when
the triggered action will occur during the day, if at all, and the alert must
be sent immediately.
In order to achieve this we need to start with our trigger. You can trigger your Flow from any automatic action that you wish but for this example we will use the Common Data Service and trigger when an Account record is created.
To keep things simple we will now simply add a Send me an email notification action.
Give your Flow a name and save.
Now we are going to perform the necessary action required to trigger our Flow. In this case, we will create an Account record in CDS. You should see your Flow run successfully and receive the notification.
Great! But what if
we now create another Account? Each time an Account record is created (or your
trigger condition is met) the Flow will execute. In order to ensure that this
Flow only runs a single time we can add a final action to the process.
Navigate back to your Flow and edit it. Add the Flow Management action Turn Off Flow. Select the environment where your Flow exists and the Flow itself from the drop down controls. Your complete process should look like this.
If we perform our
triggering action again and create a new Account record in CDS our Flow will
run as expected, and then turn itself off. Any subsequent Accounts that are
created will not trigger the Flow as it is no longer switched on.
The final piece of the puzzle is to automate the turning on of the Flow as we don’t want to have to remember to re-enable it every day! Create a second Flow with a Recurrence trigger set to run with an interval of 1 and a frequency of day. You can pick any time of day that suits you but ideally it should be early enough in the day to run BEFORE the first triggering action (Account being created) occurs. For this example, we will set to 1am.
Add a single action to this Flow, the Flow Management Turn on Flow action. Set the properties to the Flow that we created previously (the one that turns itself off).
Save this flow and
the process is now complete.
The next time the
triggering action occurs and an Account is created, our automated Flow will
trigger and send the email notification before turning itself off. Any
subsequent Accounts created on the same day will not be able to trigger the
notification as the Flow will be turned off. At 1am the following day, the
Recurrence flow will run and turn the Account trigger Flow back on ready to be