As a Power Automate user, you recognize the value of streamlining workflows and enhancing efficiency. Whether it’s automating complex processes with Power Automate, developing custom applications with Power Apps, deriving insights through Power BI, enhancing operations with AI Copilot, or exploring other powerful tools within Microsoft’s Power Platform, we have you covered. Register for our Power Platform strategy session to gain actionable insights and strategies for maximizing the potential of the Microsoft Power Platform for your business.
Some Power Automate users heavily rely on a Word template in flow to generate reports upon completion of a record in their system. Multiple users may be requesting the same template at once, which leads to the flow failing periodically, seemingly at random. The best explanation our team gathered is that for a split second, the template is “checked out” of its SharePoint location. Therefore, when a second flow simultaneously tries to populate the template, it results in an error because the template is momentarily not accessible to flow. When many documents per day are created this way, multiple flow failures per day will result. However, if users manually resubmit them, they typically succeeded without issue. Occasionally, it will take multiple resubmissions, but eventually, access to the required template is available, and the flow is successful.
Steps to automatically retry a Power Automate flow
As a result, our team developed the following technique, which keeps retrying the “Populate template” block until it succeeds or fails after 10 attempts. In brief, the technique increments a variable to count to 10 retry attempts but only if that block fails.
Step 1: Initialize an integer variable called “Retry” with a value of zero.
Step 2: Right above the “Populate a Microsoft Word template” block, insert a “Do Until” loop. Set it to go until retry is equal to 10.
Step 3: Insert a scope control called “Try.” Under “’Try’ should run after,” check the box that corresponds with “has failed.” Inside the “Try” control, increment the retry variable by one, and set a condition block to email you if the retry variable makes it to 10.
Step 4: Insert a second scope control to run after “Try” is successful or skipped. Inside this control, set the retry variable to 10. This will function as an off ramp for the repeating logic and will allow the flow to continue when the template fires correctly.
Bonus Step: In the failure alert email, if the following expression is present, the email will include a hyperlink back to the exact flow that failed.
<p>Link:
<a href="@{concat(‘https://emea.flow.microsoft.com/manage/environments/’,workflow()[‘tags’][‘environmentName’],">Go To Record</a>
</p>
While many applications for Microsoft Power Automate are free and have the potential to make your business work faster, getting the platform set up can often be overwhelming. With hundreds of connections, the process of building, testing, and customizing the connectors that work for your business may be more complex than initially expected.
How Citrin Cooperman can help
Citrin Cooperman’s Digital Services Practice has the experience and expertise to help set up the entire Microsoft Power Platform, including Microsoft Power Automate, Power BI, and PowerApps, so your company can achieve its strategic vision. To learn more about Microsoft Power Automate and the ways in which our team can assist your business, reach out to your Citrin Cooperman advisor or Andrew Yoder at sales@citrincooperman.com.
Related Insights
All InsightsOur specialists are here to help.
Get in touch with a specialist in your industry today.