Microsoft Flow – Large switches 25+ options

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 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())

Flow with a switch that has a case for day 1 to day 6

To make this all fit on your screen you might need a wide monitor!

wide screen 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.

case 26 and case 27

What should you do when you want to handle more than 27 cases in a switch?

The answer to this question is simple!

Added an additional switch in the default branch of the first case

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'.

 

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

 

 

Advertisements


Categories:Flow, Microsoft Flow, Microsoft365, Office 365

Tags:

Please leave a comment or feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: