Advanced | Flow of The Week: Creating Your Own Workplace Democracy With The Power of Approvals!

Sometimes it gets difficult to make decisions in the work place. Whether it be important documents that need review or even more essential rulings like deciding a time to get that sweet Starbucks, Flow has your back with Approvals. Right now, you can do a lot with our two current types of Approvals:

  1. Anyone from the assigned list can approve.
  2. All from the assigned list must approve.

But what if that’s not enough? I mean with “anyone can approve” you don’t want to give anyone all that power. On the other hand, with “all must approve”, you’re having flashbacks about last week when everyone wanted sushi except Jeff and he had to ruin it with a reject on your well-crafted approval. We demand democracy!

Or… maybe you just want to take your group decision making to the next level?

We’ve had lots of customers interested in more complex types of approvals such a quorums and multi-stage approvals. I assure you it’s on our minds too! Eventually we’ll have simpler built in approval types, but until then I’ll show you a way you can create your own little checks and balances system for your new team agreement accords.

I know it looks like a lot but really, it consists of two main approval steps to mimic a multi-stage approval:

Introducing: The Executive Approval. Pretty fancy sounding… because it is. At least, that’s what your local representative would say.

  1. the first stage is a majority vote approval assigned to many people (like congress).
  2. the second stage is a regular approval assigned to one person which can override the result of the first stage of the approval (like a veto).

Q: So how do we accomplish this?

A: The magic of bureaucracy of course Step by step.


Now to the real stuff.

You can start out with any trigger you want, typically something involving an item or file works well for approvals.

Stage 1: Let’s get congress to agree on something

Since a “majority must approve” approval doesn’t exist we are going to create our own using a technique that can be modified to do all kinds of approvals.

The basic idea behind this is that we have our list of approvers that we want to send this “majority must approve” approval to, but instead of sending one approval assigned to everyone, we can break it up and assign each person a single approval in parallel, collect all the responses and then decide what to make of them.

Bonus: If you would like to know how to get a dynamic list of approvers for something like a SharePoint item check out this earlier flow of the week about sending parallel approval requests for a dynamic set of approvers.

For the sake of this tutorial I just initialized an array with a list of emails to assign as the approvers.

Next, we need a way to keep track of our responses. I found the easiest way to keep track of the responses by using two separate arrays:

  1. A list of “Approve” responses
  2. A list of “Reject” responses

The reasons why this approach is great is because we can use:

  1. union in an expression to combine the two lists into one
  2. length in an expression to get the count of responses for each list

Now that we have our approvers and can keep track of responses we can add a “Apply to each” on the list of approvers and create an approval and record the response in the proper list.

It’s very important not to forget to make your “Apple to each” execute in parallel by going to options and enabling “Concurrency control”.

Finally, to complete this approval stage now that we’ve recorded our responses, we can simply just compare the lengths of the array using expressions and a condition card:

So now to complete the Executive Approval we need our stage 2 approval if the result of the first stage ended up being a majority of approve.

Note: In the case of reject you could send an email notification listing out the results as a html table. (That’s what I did, this is where concat comes in handy with more variables)

Approval Stage 2: Electric Boogaloo

This approval is just a regular approval who is assigned to an Executive approver of your choosing. Someone who you can really depend on like Tom. Tom is really dependable…

You can just hook this approval up to another conditional and now the multi-stage approval is essentially done! Our Executive approver can now make decisions; Simple right? Well…

Q: How can a Flow certified public figure such as an Executive approver make a good decision without any context?

A: Magic We can pass the responses we recorded from Stage 1 into the details field of the Stage 2 approval. The details field for approval accepts markdown now so we can make the results look pretty.

Now we don’t just need to store whether someone approves or rejects the stage 1 approval, we also want to know who it was and their comments, which can be stored as JSON in the arrays. We can go back and edit our append variable actions to be something like:

In order to create a pretty markdown table using our newly stored information we have to add logic to convert the responses to markdown. First, we’ll initialize another variable to keep track of the converted markdown since we can have a dynamic number of responses:

(You can read up on approval details markdown capabilities here)


To finish the conversion, we can do a “Apply to each” on the union of our two response arrays to make a single one after we get all the responses. Inside the loop we can parse the JSON objects we added and use the values in a “Append to variable” action to convert the responses to markdown table rows to our variable like so:

Finally, we can just use the markdown table variable we created as part of the approval details in the Stage 2 approval. The markdown we added should look like this once the flow is working as intended:

That should finish out the Executive Approval! Everything else I added to my example flow is fluff such as adding a markdown list of all the approvers to each individual approval in stage 1. Now you are ready to impress all your coworkers with your consitutional rulings!

Bonus: Instead of initializing each variable in an individual action because they can quickly bloat the flow, you could create a single JSON object that represents the state to store every variable. You can then edit the properties of the object to update it.

I hope everyone enjoyed this and I’m interested to hear what other ideas people have building off of this! Leave a Comment Below!