January 28, 2021

All you should know Condition and Switch Condition in Power Automate (MS Flow)

Introduction: 

We implemented the automated process using Power Automate (MS Flow) for a Postal and Parcel company based out of Melbourne, Victoria, Australia. The automated process was lengthy in terms of implementation that required many if/else conditions and routes. In this blog, we will understand the difference between Condition and Switch control in Power Automate (MS Flow), the benefits of using it, and also discuss its limitations.

So, let’s first talk about Limitations for Condition and Switch Actions:

  • In Power Automate, if we use Condition Action, then we can add max. 8 nested steps and 500 actions per flow.
  • In Power Automate, if we use Switch Action, then we can add max. 25 nested steps and 500 actions per flow.

How to overcome the limitation for Conditional Statements?

Now, let’s talk about how we can overcome this limitation? We came across a scenario wherein we reached the 8th nested level with a conditional statement, then what can we do?

To overcome such a scenario, we can implement “Child Flow”. To, implement the concept of the child flow, we need to follow the below steps. The detailed information with a real-life scenario for creating a child flow can be referred to from this Blog Post. Below is the summary for the same.

  1. Create a Flow Solution. (To create a child flow, we must have to create a solution file.)
  2. Create a Child Flow
  3. Call Child flow from Parent Flow.

How to overcome the limitation for Switch Statement?

  1. To overcome this limitation you can add another switch case in default options and this way you can add another 25 cases.
  2. The default will execute if there is no match found.

Comparison between If and Switch.

If Conditions

  • Easy to Understand
  • Not practical if we have a lot of conditions.
  • Hard to visualize on the screen if we have more conditions.
  • There is a limit of 8 nested conditions (as of the writing of this post). 

Switch

  • Easy to setup.
  • Easy to visualize on the screen
  • Switch Case action only accepts string and integer when it compares values. So in case you have a date field or other column types, you would need to first initialize a variable and set it to be either a String or an Integer.
  • Cannot compare against Range.

Conclusion:

Hope, this helps to identify the limitations, solution, and comparison between Condition and Switch Action in Power Automate.   

If you have any questions you can reach out our SharePoint Consulting team here.

No comments:

Post a Comment