cancel
Showing results for 
Search instead for 
Did you mean: 

Creating a "Run Once" Daily Trigger using Power Automate

Creating a "Run Once" Daily Trigger using Power Automate

 

Scenario:

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.

 

Solution:

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.

 

chrome_2020-01-24_10-02-25.png

 

To keep things simple we will now simply add a Send me an email notification action.

 

chrome_2020-01-24_10-03-47.png

 

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.

 

chrome_2020-01-24_10-06-58.png

 

OUTLOOK_2020-01-24_10-08-02.png

 

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.

 

chrome_2020-01-24_10-11-48.png

 

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.

 

chrome_2020-01-24_10-18-20.png

 

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).

 

chrome_2020-01-24_10-20-40.png

 

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 triggered again.

Meet Our Blog Authors
  • Experienced Consultant with a demonstrated history of working in the information technology and services industry. Skilled in Office 365, Azure, SharePoint Online, PowerShell, Nintex, K2, SharePoint Designer workflow automation, PowerApps, Microsoft Flow, PowerShell, Active Directory, Operating Systems, Networking, and JavaScript. Strong consulting professional with a Bachelor of Engineering (B.E.) focused in Information Technology from Mumbai University.
  • Encodian Owner / Founder - Ex Microsoft Consulting Services - Architect / Developer - 20 years in SharePoint - PowerPlatform Fan
  • Cambridge UK Power Platform User Group Leader, Technical evangelist and speaker. Always says yes to coffee! #LetsGetCoffee
  • Passionate #Programmer #SharePoint #SPFx #Office365 #MSFlow | C-sharpCorner MVP | SharePoint StackOverflow, Github, PnP contributor
  • I am building business processes and applications that are easy for users' to stick to, so they can follow and understand them. In overall I transform processes to be more reliable and effortless. I am a proud co-organizer of SharePoint Saturday Warsaw and active community member, blogger and international speaker.