We’ve all been there; an approval sent from Power Automate times out because the flow had reached its 30 day run limit, which makes it impossible to complete the approval process.
In this blogpost, I’ll explain to you how to configure an approval process with Power Automate which allows you to exceed the flow’s 30 day run limit.
First, let’s clarify where the bottleneck in Approval time-outs lies.
Approvals are entities that live in Dataverse (previously called CDS) and theoretically exist forever. So the approval action is not the direct bottleneck for the process to time out. The main problem is that a single flow cannot run for more than 30 days according to the Power Automate Duration and retention limits.
There is nothing you can do about this. Even premium licenses will still have the same duration and retention limits.
In the previous chapter, I specifically stated that a single flow cannot run for more than 30 days. That is exactly where your configuration of a long running approval differs from the casual approval flow configuration. You must configure your process into two flows (parent and child) instead of a single flow.
Parent flow – Initiating the approval
The parent flow is basically the flow you’ll create when configuring an approval flow, but without the entire outcome processing. That will be configured in the child flow.
So you can just create a flow that contains whatever process you need to configure, but this is where it differs from your casual approval flow:
Instead of configuring the Start and wait for an approval action, you only configure the Create an approval action. In my example below, my process is just a manual trigger and the Create an approval action, but you can use whatever configuration you want.
This will initiate the approval and send it to the approver. After that, you need to make sure the child flow can take off where you left; processing the outcome of the approval. That’s why you add a new item in a SharePoint list (or any other trigger you want to use). This list must contain at least the following information:
- Approval ID
So I created a new list in SharePoint, added the single line of text column called Approval ID to that list and made the Title column optional (because I won’t be using that column):
Back to your flow:
Inside your Create an item action, you will point to your newly created list and add the Approval ID from the Dynamic Content of the Start an approval action to the Approval ID column:
That is all you need to configure for your parent flow.
Child flow – processing the outcome
By adding a new item to a SharePoint list, you can now trigger a new flow using the When an item is created trigger. This flow contains the entire outcome handling (again, whatever you want to configure), but also a mechanism that will monitor the duration limit
Processing the outcome
This is basically just your outcome processing configuration as you’re used to, but with 2 differences:
- Instead of using the Start and wait for an approval action, you only need to use the Wait for an approval action. You also can’t use the Approval ID from the Dynamic Content of your Start an approval action, because that action doesn’t exist in this flow. Therefor, you need to use the Approval ID column from your trigger
- You also need to make sure your flow chain doesn’t go into an endless loop (see next paragraph). That’s why you need to stop your flow after the outcome has been completely processed. You can do this by adding a Terminate action at the end of your outcome processing configuration.
You may also want to clean up your SharePoint list by deleting the current item that the flow has triggered upon using the Delete item action:
Monitoring duration limit
Parallel to that outcome processing, you need to configure a process that will monitor the duration limit for you. You can do this by adding a parallel branch to your flow (using the + icon right after your trigger and selecting Add a parallel branch.
Inside your newly created parallel branch, you need to add a Delay action and configure it for 29 days. This will delay your parallel branch for 29 days, but will keep your main branch running.
Now you need to make sure this child flow gets triggered again after having been run for 29 days without response. To do this, you need to configure the same Create an item action that you created in your parent flow, but instead of using the Approval ID from the Dynamic Content of your Start an approval action (which doesn’t exist in this flow), you pick the Approval ID from the trigger itself:
To keep your list in SharePoint nice and clean, you can delete the current item that the flow has triggered upon. Because you don’t want this flow instance to wait for the approval outcome anymore, you need to end the flow by using a Terminate action. I gave my termination status Cancelled on this side of the parallel branch so I can differ both branches from each other:
When both parallel branches have been configured correctly, your child flow should look something like this:
Where the left side if your outcome processing configuration and the right side is the duration limit monitoring.
Please note that there is a gap of 1-15 minutes between flows triggering other flows when creating new SharePoint items. So there might be a slight chance that your approval will be processed between a new item is created and the child flow is (re)started which will cause your approval process to fault. You can see this when entering the Peek code mode of your trigger:
Please note that your Power Automate plan also involves the maximum trigger interval of your flows:
- Premium (per flow/per user): 1 minute
- Microsoft 365 integrated: 5 minutes
- Free/trial: 15 minutes.
If you find this risk is too high, you may want to consider using Logic Apps where you can configure the trigger interval for yourself.