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

Switch Action not working with Microsoft Forms Responses

As per the attachments below the switch action i have implemented into my flow isn't working.

 

I have set the case names as the answers for Place of incorporation/establishment in my Microsoft Form. However when i run the flow it goes to the default case which is if no case contains a matching value. This is because there is brackets and " around the answer in the switch action after running the flow but i can't add the brackets or " in my cases.

 

Switch Action not working.pngexpression result.pngexpression result 2.png

10 REPLIES 10

HI Aazza,
I think you can try removing the brackets and quotes and such like so:

After your Get Response Details add a 
COMPOSE action with expression:
replace(outputs('Get_response_details')?['variables/Place of Incorporation'],'[','')

Then a second COMPOSE ACTION with expression:
replace(replace(outputs('Compose'),']',''),'"','')

And finally you need a THIRD COMPOSE to SPLIT the result like so:
split(outputs('Compose_2'),',')

NOW add an APPLY TO EACH step
and put your SWITCH in it!
Outputs('Compose3')
with the Output that of final Compose as the input for the switch. 
applytoeach.jpg

HTH

Hi @AndreaMondello 

Thank you for the response, i have just attempted this and it is returning a flow run failed.

unable to process.png

Aazza can you show me what is in your first Compose expression?

As requested here is what is in compose 1, i copied and pasted the expression you gave me.


compose action 1.png

Actually, in your case, remove the 'variables/Place of incorporation/establishment' and use the dynamic content picker to choose your form value. Sorry about that. 🙂

I have now made these changes and am now facing another error, this is to do with the compose action 3 now.

 

the execution of the template action.png

Hi @Aazza 

Has your problem been solved?

Please take a try with below screenshots:

vLilyWmsft_0-1638761083381.png

Expression:

json(outputs('Compose'))

vLilyWmsft_1-1638761150966.png

vLilyWmsft_2-1638761199760.png

Test Results:

vLilyWmsft_3-1638761250274.png

Hope the content above may help you.

Best Regards

If my answer helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi Lily,

Thank you for the response, unfortunately after trying it with the screenshots you have provided the flow is still not running correctly.

 

The options I have on my Microsoft Form are, Hong Kong, Singapore, China and Other and even though the expression result of the switch was China instead of the flow continuing to the China Case it has gone to the default case where if no case contains a matching value.

json expression.png

Hi @Aazza 

Please check if there is a space where the arrow points, if there is any space, please delete it and try again.

vLilyWmsft_1-1638783836353.png

vLilyWmsft_0-1638783783938.png

Best Regards.

 

Hi Lily,

 

I have just checked and neither of them have spaces where the arrows are

no space.pngno spaces 2.png

Helpful resources

Announcements
Microsoft 365 Conference – December 6-8, 2022

Microsoft 365 Conference – December 6-8, 2022

Join us in Las Vegas to experience community, incredible learning opportunities, and connections that will help grow skills, know-how, and more.

Users online (3,430)