Build Microsoft Flows with a Compound Condition or Switch (instead of nested Conditions)

The Need:
Building flows that go beyond Yes/No questions

Common Approaches
Multiple levels of nested Condition steps

Better Methods:

  • Use a Control: Switch
  • Use a Compound Condition

Previous posts on this blog have explained how to expand a flow's versatility with a date expression in Conditions (Part 1 and Part 2). A flow with a date expression can be fairly sophisticated, but the actual Control: Condition step is pretty basic. Limiting your flow to "Is it YES or NO?" decisions could be insufficient for what you want to do.

If you need to trigger actions depending on more than two options--Did this email come from Alligator, Bird, or Cat?--you could put Condition steps inside higher level condition steps. It's not hard to do but it can get messy very fast.

The flow shown below triggers on emails that come from Alligator, Bird, or Cat. If an email comes from Alligator, a file is created and given the name, "Alligator." When email comes from Bird, you don't want to name it Alligator. You want to name it "Bird." When email comes from Cat, name the file "Cat." But if email comes from Dog or any other animal, do nothing.



You can nest Conditions to eight levels, and they hide inside each other like matryoshka dolls. If Cat switches departments and is replaced by Dog, you have to open Condition box after Condition box to find the Cat one so you can update it. This... can take a lot of time.



A Control: Switch step is easier to design and to update.
Instead of building a flow that asks, "Is it from Alligator? No? Then is it from Bird? No? Then is it from Cat?" ad nauseam, reframe the question: "Who is this email from?" Add a Switch instead of a Condition, and add the options to the flow as "Cases".


You can add another Switch, a Condition, or any other flow step to a Switch case; flows can have very complex operations inside Switches. But when Cat moves to a new department and is replaced by Dog, it's a simple matter to update the flow. The Switch step is right at the top of the flow, and you can change "Cat" to "Dog" in one case without needing to dig further.

NOTE: You can add up to 25 cases to a Switch. The most I ever put into one Switch is 11 cases, which is impossible to show on one screen at a magnification I can read. To avoid this situation, you could create more than one flow to do the same thing. Pick five or six cases, make the flow, save, save a copy, and update the case fields in the new flow. If you rename each flow to include the cases in the flow titles, it will be easy to search for the one you want if you have to update it later.

You might build a flow with a Switch to:
  • alert different people when an item's status is changed on a SharePoint list (depending on the status)
  • alert different people when a selection is made from Choice column on a SharePoint list (depending on what is selected)
  • trigger a process when a file created by a specific person in a designated folder
  • add an item on one SharePoint list to other SharePoint lists, depending on updated features/characteristics of the item

Use compound conditions to avoid duplicate effort.
I love the Switch step, but it can require repetitive work to build the process inside cases. For some reason, I have trouble copying steps to My Clipboard in one case and pasting them to other cases; I always end up recreating steps manually and it can get very tedious. If you have many options/cases but not that many different actions, you might use a Compound Condition step instead of a Switch. You are not limited to one condition per Condition step. You can add rows and groups, and use And/Or, inside the Condition.





The flow below shows what should happen when email comes from Alligator or Bird or Cat or Dog. You could have a switch with four cases (Alligator, Bird, Cat, Dog) but observe: Alligator and Bird emails trigger identical actions; Cat and Dog emails trigger identical actions. Ideally you would build a flow with only two unique actions instead of a flow that doubles one action and doubles a second action. So, add Alligator and Bird to the first Condition, and then Cat and Dog to the second.



Switches, Conditions, and Compound Conditions have a lot of overlapping functionality. As you gain experience creating Microsoft flows, you will develop a knack for when which option best suits your need.

A note on a text:
Brave New World by Aldous Huxley. In which human lives take distinct paths depending on the conditions present during gestation. Question for discussion: Betas don't work very hard and they get to wear blue. Do you think you would be awfully glad to be a Beta?



Comments