cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
LucasLopesr
New Member

How can I create an approval flow that accepts a majority vote

Hello everyone, I hope you're okay.

Today I need to create an approval that considers the majority of votes, but the default options do not meet this scenario.
My approval flows today are:
1. Start approval with 5 voters, when it reaches 3 votes, voting must end;
2. Express flow - Start approval with 3 voters, when it reaches 2 votes the voting must be closed;

Has anyone ever needed something similar?

 

thanks in advance.

1 ACCEPTED SOLUTION

Accepted Solutions
Rhiassuring
Super User
Super User

Hi @LucasLopesr , 


This solution outlined by @pawanjajoo may be of great use to you: Approvals with Majority in Power Automate - however, this isn't parallel, it's serial - one person at a time. Not sure if that's alright with you.


In the area where he has the "Increment Rejection", you could always have another condition that says "Is this more than half of the total? If so, end entire workflow."  ...the problem though is that there isn't a "Terminate" inside of loops, and no way to say "Exit Loop". So it would continue to the end.

 

There is this workaround detailed out by @Anonymous Break Loop but as you'll see, it's quite a bit of work to implement.


Thinking about it a bit, in your scenario I might use a "Do Until". My flow might look something like...

 

1) Get the users into an array.

2) Count the users. Store in a variable.

3) Initialize each a rejection and approval variable, set to 0. Initialize a loop counter (eg, intLoopCounter) variable, set to 0.

4) Create a "Do Until" loop - set the condition to something like, "Until Rejection is higher than half the total votes" OR "until approval is higher than half the total voters" OR "until this has looped the same number of times that there are voters"

 

Inside the loop, it'd look like...

 

1) Increase loop counter by 1.

2) Get variables(arrVoters)?[intLoopCounter]

3) Start & wait for an Approval.

4) Condition based on outcome - increase Approval or Rejection.

 

That would the function until you hit a majority, or got through all people, and then end. 

That's just thinking outloud. Let me know what you think.

 

Rhia

 

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



View solution in original post

1 REPLY 1
Rhiassuring
Super User
Super User

Hi @LucasLopesr , 


This solution outlined by @pawanjajoo may be of great use to you: Approvals with Majority in Power Automate - however, this isn't parallel, it's serial - one person at a time. Not sure if that's alright with you.


In the area where he has the "Increment Rejection", you could always have another condition that says "Is this more than half of the total? If so, end entire workflow."  ...the problem though is that there isn't a "Terminate" inside of loops, and no way to say "Exit Loop". So it would continue to the end.

 

There is this workaround detailed out by @Anonymous Break Loop but as you'll see, it's quite a bit of work to implement.


Thinking about it a bit, in your scenario I might use a "Do Until". My flow might look something like...

 

1) Get the users into an array.

2) Count the users. Store in a variable.

3) Initialize each a rejection and approval variable, set to 0. Initialize a loop counter (eg, intLoopCounter) variable, set to 0.

4) Create a "Do Until" loop - set the condition to something like, "Until Rejection is higher than half the total votes" OR "until approval is higher than half the total voters" OR "until this has looped the same number of times that there are voters"

 

Inside the loop, it'd look like...

 

1) Increase loop counter by 1.

2) Get variables(arrVoters)?[intLoopCounter]

3) Start & wait for an Approval.

4) Condition based on outcome - increase Approval or Rejection.

 

That would the function until you hit a majority, or got through all people, and then end. 

That's just thinking outloud. Let me know what you think.

 

Rhia

 

______________________________________________________________


Did this answer your question? Please mark it as the solution.
Did it contribute positively towards finding the final solution? Please give it a thumbs up.

I answer questions on the forum for 2-3 hours every Thursday!



Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (1,711)