There are many limitations with Microsoft Flow. Among these limitations, a few limits which we frequently suffer from are:
- We can only have 8 nested levels of conditions in a Flow.
- We can have 250 actions per Flow
- Apply to Each action will work for 5000 items with Free license.
Here, we will discuss how to avoid the nesting of conditions, with an example.
Scenario
- On Item create we have to trigger the flow
- If the Department is equal to Sales
- If Category 1 value of the created item is not blank
- Get its Category Manager
- If the Manager is blank
- If Category 2 is not blank
- Get manager
- If the Manager is Blank
- If Category 3 is not Blank
- Get Manager
- If the Manager is Blank
- If Category 4 is not blank
- Get Manager
- If the manager is blank
- Send an email to Lead
To understand it better, below is a flow chart which shows nesting.
Hence, there are more than 8 levels of nesting in our scenario.
Note
Here, Category 1, 2, 3 and 4 are Column names, not the value of Category column so we can not use Switch Case here.
Analysis
If you analyze the Scenario carefully, the main aim of the Flow is to get Manager from any of the 4 Categories and send an email to notify that the item has been created in the Sales Department. If the Manager is blank for all the categories, send an email to the Lead. If we get Manager from any of the categories, we can stop the flow.
Solution
To break this nesting by reaching to the aim of the flow, including all the conditions, is the one option we have here. To achieve this, we can have the below scenario.
Solution Scenario
- If Department = Sales
- If Category 1 != Blank
- Get Manager - > Send an Email -> Stop the Flow
- If Manager = Blank
- Do Nothing
- If Category 2 != Blank
- Get Manager - > Send an Email -> Stop the Flow
- If Manager = Blank
- Do Nothing
- If Category 3 != Blank
- Get Manager - > Send an Email -> Stop the Flow
- If Manager = Blank
- Do Nothing
- If Category 4 != Blank
- Get Manager - > Send an Email -> Stop the Flow
- If Manager = Blank
- Send an Email to Lead -> Stop the Flow
To understand better, refer to the below flow chart image.
Explanation
In this flow, we will check if the value of Category 1 is not blank, we will get the manager. If a manager is blank, we will do nothing, else send an email and stop the flow.
If we do not add any action, our Flow will return back to the upper level so in our case it will return back to 1st Level and there we will check for the value of Category 2 and repeat these actions until we get the manager. If we don’t get the manager even from Category 4, we need to send an email to the Lead of the Sales Department.
Thus we get manager form Categories checking all the conditions reaching our goal.
Summary
Hence we analyzed our conditions, broke down the conditions and reached the goal. We can also break down the flow using Nested Flow which means we run child Flow from Parent Flow. There may be other solutions available. We need to analyze our conditions properly to see which solution will be feasible for us to reach the goal.
References
https://docs.microsoft.com/en-us/flow/limits-and-config
I hope you like this article. Feel free to give your feedback in the Comments Section.