PoI have a client who is heavily using a Word template in Power Automate to generate reports upon completion of a record in their system.  This can mean the same template is requested by multiple users at once and has led to the flow failing periodically and seemingly at random.

The best explanation I have come up with is that for a split second, the template is “checked out” of its location on SharePoint and when a second flow tries to populate the template simultaneously, you get an error because the template is momentarily not accessible to flow.  We are creating so many documents per day this way that I was getting a few flow failures per day and when I went in and manually resubmitted them, they typically succeeded without issue.  A few times, more than one resubmission was needed but they eventually were able to get access to the needed template and succeed.

This led to the below technique that will keep retrying the “Populate template” block until it succeeds or fails after 10 attempts.

In brief, the technique is to increment 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.

Power Automate Initiate Retry

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.

Power Automate Do Until

Step 3: Insert a scope control called ‘Try’. Configure Run After to ‘has failed’.  Inside the Try control, increment the Retry variable by 1 and set a condition block to email you if the ‘Retry’ variable makes it to 10.

Power Automate Scope Control

Power Automate Try

Step 4: Insert a second scope control to run after ‘Try’ is successful or skipped.  Inside it set the Retry variable to 10.  This functions as an off ramp for the repeating logic and allows your flow to continue if/when the template fires correctly.

Power Automate Second Scope Control

Bonus Step!

In your failure alert email, if you add this expression, your email will include a hyperlink back to the exact flow that failed.


<a href=

@{concat(‘https://emea.flow.microsoft.com/manage/environments/’, workflow()[‘tags’][‘environmentName’], ‘/flows/’, workflow()[‘name’], ‘/runs/’, workflow()[‘run’][‘name’])}

>Go To Record</a><br></p>

Power Automate Failure Alert Email

Need more Power Automate help?

Let MIBAR help your team unlock their potential by removing obstacles, distractions, and manual processes. As a longtime Microsoft Partner and leading consultant, we get to know your business and find out how to help you do more with Microsoft Power Automate. Learn more here or contact us today.