cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
geophman
Level: Powered On

Case Switch from an MS form not working

I have a flow built to create task in Planner and assign it to a specific person based on an answer to a question on an MS Form.  I'm using a Case Switch, but it's not matching the text string from the Form to the text on the case.  What am I missing?Flows failure.jpg

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: Case Switch from an MS form not working

Hi @geophman as it's a Forms question that allows multiple answers we need to split out each answer and add it into a string variable. In my example below the user can select 1 or more sessions to attend:

0-Form.pngMultiple answers to question

So after the When a new response is submitted trigger and Get  response details action we need to add an Initialize string variable which I've called varSession

The next action is a Parse JSON action and the syntax you need to add is

 

{
    "type": "array",
    "items": {
        "type": "string"
    }
}

 

1-Trigger-InitVar-Parse.pngParse JSON

Next add an Apply to each control and select Body from the dynamic content.

Inside the Apply to each add an Append to string variable, select the name and for the value select Item from the dynamic content

The next action is to add the Switch control and select the string variable from the dynamic content.

2-Apply-Append-Switch.pngAppend to string variable

In each switch case you then add the Planner Create a task action. But then you need to reset the variable back to null before the next multi-choice answer is looked at, so add a Set variable, select it and in the value field add the expression null

3-SwitchCase-CreateTask-SetVariable.pngSwitch Case

In my form I selected both SharePoint and Power Automate as the sessions to attend and this is the result of the SharePoint answer. The Power Automate answer went down its switch case channel correctly as well.

4-Result.png

Rob

Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

View solution in original post

6 REPLIES 6
Super User
Super User

Re: Case Switch from an MS form not working

Looks like the answer is AEDs and your looking for AED/PAD

Super User
Super User

Re: Case Switch from an MS form not working

@Gristy no it's not that, the switch case has just been renamed to AED/PAD.

@geophman [Edited response] it's because your question in Forms is multi-select. I'll post a solution for you shortly.

Rob
Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

Super User
Super User

Re: Case Switch from an MS form not working

Hi @geophman as it's a Forms question that allows multiple answers we need to split out each answer and add it into a string variable. In my example below the user can select 1 or more sessions to attend:

0-Form.pngMultiple answers to question

So after the When a new response is submitted trigger and Get  response details action we need to add an Initialize string variable which I've called varSession

The next action is a Parse JSON action and the syntax you need to add is

 

{
    "type": "array",
    "items": {
        "type": "string"
    }
}

 

1-Trigger-InitVar-Parse.pngParse JSON

Next add an Apply to each control and select Body from the dynamic content.

Inside the Apply to each add an Append to string variable, select the name and for the value select Item from the dynamic content

The next action is to add the Switch control and select the string variable from the dynamic content.

2-Apply-Append-Switch.pngAppend to string variable

In each switch case you then add the Planner Create a task action. But then you need to reset the variable back to null before the next multi-choice answer is looked at, so add a Set variable, select it and in the value field add the expression null

3-SwitchCase-CreateTask-SetVariable.pngSwitch Case

In my form I selected both SharePoint and Power Automate as the sessions to attend and this is the result of the SharePoint answer. The Power Automate answer went down its switch case channel correctly as well.

4-Result.png

Rob

Los Gallardos
If I've answered your question or solved your problem, please mark this question as answered. This helps others who have the same question find a solution quickly via the forum search. If you liked my response, please consider giving it a thumbs up. Thanks.

 

View solution in original post

geophman
Level: Powered On

Re: Case Switch from an MS form not working

So I think I got it.  I added the actions you suggested and tested and it failed.  I've attached a pic.  I'm not sure what I missed.

 

-Geoff

Flow fail.jpg

Super User
Super User

Re: Case Switch from an MS form not working

Could you post a screenshot of the flow steps from your Parse JSON to the Switch please. The result of your switch is showing ["AEDS"] whereas mine was SharePoint without the bracket and quotation marks so something is not quite right.

Rob
Los Gallardos

geophman
Level: Powered On

Re: Case Switch from an MS form not working

Thanks Rob!  I didn't know if that was ignored formatting, now it seems that it isn't.  Here's the other part of the flow.

Flow fail.2.jpg

Helpful resources

Announcements
firstImage

New Ranks and Rank Icons in April

Read the announcement for more information!

firstImage

Better Together Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Community Summit North America

The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (10,030)