Recently, I was told by one of my followers that the switch step in Microsoft flow can only handle 27 options. So I thought today I will put this to the test.
I started with a large switch that tests for the current day of the month. This should return 1-31.
I’m using the following expression for this:
dayOfMonth(utcNow())
To make this all fit on your screen you might need a wide monitor!
When you get to your 27s case in your switch statement the + icon simply doesn’t work. No error messages or warnings. Just plain nothing happens.
What should you do when you want to handle more than 27 cases in a switch?
The answer to this question is simple!
Create a second switch in the Default branch of the first switch. Yes, you could even place the two switches underneath each other as two sequential steps but that would make it harder to understand the logic of the flow when you need to debug the flow using the run history.
But then as a built my flow and I tried to save the flow I got the following error message
The template action ‘Switch’ at line ‘1’ and column ‘958’ is not valid: the number of cases used ’27’ exceeds the maximum number allowed ’25’.
Well that is very clear. The limit is 25 items, but you are only told as you save the flow. Reducing the number of cases to 25 in my flow solved the problem