“I have a special task in my flow where 2 out of 5 users must approve, not one, not all, but exactly 2, can I do it in Power Automate?”
When using the Approvals functionality in Power Automate, you’ve got a few options for each task. The main ones are the available responses and how many users must complete the task. Should it take the first response as the outcome of the whole task, or should it wait for everyone to respond? One user or all of them, nothing in between.
Yet in some situations it’s not that simple. You might be interested in opinion of more people, but at the same time you don’t want to wait for everyone. That’s why this article will show you how to create an approval where only a specific number of users must reply.
Note: this solution requires Power Automate premium license.
Start by creating the task
Since it’s an approval task, the first step is to create it. Use the ‘Create an approval’ action set to ‘Wait for all responses’.
Once you create the task, end the flow. You don’t want to wait for the response using the standard action as that one would wait for everyone to response (not the goal of this solution).
Check the task completion in Dataverse tables
Instead of waiting in the first flow create a second flow. A flow that’ll monitor the Approval related Dataverse tables and trigger on a specific row creation.
There’re two Dataverse tables relevant to this solution – Approval Responses and Approvals. Approvals is the main table with all approval tasks including their status. Approval Responses contains all responses to these tasks. If there’s a new response it’ll create a new row in the Approval Responses table – a potential trigger for the flow.
Since the flow will trigger for all completed task, you should limit it at least a bit using a trigger condition. Unfortunately it doesn’t contain the task title. The only way to decide whether it’s a response for my task is to check the specific response. My task expects the OK response which should be unique in my environment.
@equals(triggerOutputs()?['body/msdyn_flow_approvalresponse_response'], 'OK')
Note: if the response is not unique you can use ‘Get a row by ID’ action to find the approval task in the Approvals table and check the task name.
As already mentioned, this table will contain all responses for all approval tasks. Therefore, the next step is to check whether there’s already another response for the same approval task. That means a ‘List rows’ action with a filter based on task id.
msdyn_flow_approvalresponseidx_approvalid eq '@{triggerOutputs()?['body/msdyn_flow_approvalresponseidx_approvalid']}'
At the same time you can limit which columns you want to get from each task. I’m limiting it to approval task id, creation date (response date), approver name, response, and response comments using the Select columns field. It’s the column I use in the HTML approval history table.
msdyn_flow_approvalresponseidx_approvalid,createdon,_ownerid_value,msdyn_flow_approvalresponse_response,msdyn_flow_approvalresponse_comments
Follow with a condition that’ll check how many rows it found with the length(…) expression.
length(outputs('List_rows')?['body/value'])
Close the task
But the task is completed only from your point of view at this moment. It still exists in the Approvals app and is waiting for everyone to complete the task. Unless you complete it intentionally.
If there’re 2 or more rows the task can finish – 2 responses are enough. When the condition is met, when there’re enough responses, you can complete the whole task. That means updating the row in the Approvals table.
Set the task final status and the completion date to right now. Once it’s updated the task will be closed and it’ll disappear from the task lists of all the remaining users.
Summary
Even though Power Automate doesn’t allow a specific amount of approvers, you can still build a flow where e.g. 2 out of 5 must approve. You’ll just have to get a bit deeper in the underlying Dataverse tables and replicate the functionality that’s otherwise done with a single action.
All approval task responses are in the Approval Responses table – keep monitoring it for new rows. Every time there’s a new row with a specific response, keep looking for other responses on the same task. Once you’ve got enough responses, you can close the task and continue in your flow.