cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Helper II
Helper II

No option to include dynamic content in switch case

No option to include dynamic content in switch case so I used text - tried "yes" and "true". Getting error:

 

The execution of template action 'Switch' failed: The result of the evaluation of 'scope' action expression '@triggerBody()?['Check_x0020_here_x0020_to_x0020_']' is not valid. It is of type 'Boolean' but is expected to be a value of type 'String, Integer'.

 

Untitled.png

1 ACCEPTED SOLUTION

Accepted Solutions

I tried using a variable to format the response as a string which it does but it now fails for a different reason. Sorry to keep on about this but there doesn't seem to be any helpful Msft documentation, which is pretty poor.

Untitled.png

 

 

View solution in original post

13 REPLIES 13
Dual Super User III
Dual Super User III

Try wrapping the field in a String() function using the expression tab.  That should output the boolean as text.  But if its Boolean, why use a Switch.  Booleans only have two values. In that case you would be as well off using a Condition.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Initially, I used a condition but if the response was "no" the flow failed. I tried a switch control to see if that resolved the issue. There's no action required if the response is "no", so I just need the flow to continue to the next step, but it doesn't. 

Dual Super User III
Dual Super User III

There's a common problem that comes up when working with boolean fields in a condition.  When testing against true/false the test is case sensitive.  The way to fix that is to use the true/false enumeration rather than just typing in true or false.  To get the enumeration value insert the value using the Expression tab in the dynamic content dialog.  As you type true or false it will show the enumeration value in the intellisense.  Picking that will always test the value appropriately.  Here's a screenshot.

image.png



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Yep, that's the way I set up the condition. It fails to move to the next step if the response is false, I assume because no action is specified in the "false" option. Is there an action to force it to move on regardless of response in the condition? Or do I have to add some random action there?

 

Untitled.png

Dual Super User III
Dual Super User III

It should move on to the next action even if there isn't anything there.  If you just want to put something there to test it you can just use a Compose Action with a static value.   But when you say next action do you have more than what is shown in your screenshot?  Because your screenshot doesn't show any next action.  Just the actions that are taken on the yes side.



-------------------------------------------------------------------------
If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Ok, now it moves on to the switch action, but fails there because it finds a "null" value instead of a string? There are 3 dynamic choices offered - get item, update item and when an item is created - but no hint as to which one to use.  The interface is really frustrating....

 

Untitled.png I've now tried all 3 flavors and all throw an error. Hard to imagine how Msft could make this any less intuitive.

Responsive Resident
Responsive Resident

@webbrewer 

 

If the Condition action block is working now, why are you still using the Switch?

 

Could you maybe give a little background/context for your Flow to give an understanding of what it is you want it to do?

 

thanks,

Kyle

Sure.

When item is created

Condition checks value in a boolean field and if true, updates another field with manager email 

Switch checks value in a choice field and sends a different email depending on the choice value

Responsive Resident
Responsive Resident

@webbrewer,

 

thank you,

 

You're sure that

 

1. You are passing in something to be checked against the cases, and

2. Each of your cases has something to check against?

 

Those are my top guesses as to why the error message would say that the type is "Null".

 

Then, is there the possibility that nothing was chosen in the choice field?

 

thanks,

Kyle

Yes. 

Untitled.png

Item in SP:

Untitled.pngA

I tried using a variable to format the response as a string which it does but it now fails for a different reason. Sorry to keep on about this but there doesn't seem to be any helpful Msft documentation, which is pretty poor.

Untitled.png

 

 

View solution in original post

Responsive Resident
Responsive Resident

@webbrewer ,

 

The error seems to be with the "Send Email Notification" action block. Could you provide a screenshot of that from the failed run?

 

thanks,

Yep, while I was making the other changes the flow decided to strip out the email address so that would account for the latest error! Once I added back the email address field, it sent an email but now the email body showed the raw html instead of rendering it properly. I had to replace all the email body sections to get it to finally work....

 

Have to say that though the flow interface looks more user friendly than the old workflow one, it's a long way from being a finished product ready to hand off to "citizen developers". Way too many glitches and gotchas. Thanks for sticking with me!

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Top Solution Authors
Top Kudoed Authors
Users online (7,132)