web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Switch case with a cho...
Power Automate
Unanswered

Switch case with a choice field errors

(0) ShareShare
ReportReport
Posted on by 11

Hello,

 

I'm running into errors with a simple switch case and can't figure out the problem. I have a choice field in my list called "Approval Status" with 4 choices: Submitted by Division, Approved by HR-Finance, Approved by ELT, and Hired. Screenshot below:

Flow Error.PNG

 

When attempting to run, I get the following error: 

 

Flow Error Message.PNG

 

What am I doing wrong? When I changed the field just a free text, string field, everything ran fine. Why is this choice field passing it as an 'Object' instead? Looking at a few other posted cases makes me think this should be working as is. 

 

Thank you

Categories:
I have the same question (0)
  • MarkStokes Profile Picture
    561 on at
    Please put a Compose action above your switch and put the Approvals Status field in there. Then run it and show us the output from that.

    I think it will show an “Object” rather that the value. Is Approval Status a Choice? Or a lookup Column?

    And, just to check, there “is” an Approval Staus set on that list item?

    Could you also expand out the Output of the trigger event so we can see all the item properties that is sent over in the Flow. That should show what is being sent for Approval Status.

    - Mark
  • Dorul Profile Picture
    340 on at

    Hi @rzaddTDOE

    It happens to have an example exactly like yours, just my column name is Depart, as we had a few departments to choose from. Use the "Initialize variable":

    Capture.JPG

     

     

     

     

     

     

     

    Also you dont need to create so many "send emails". Can use just one and at "To" field use the expression:

    if(equals(variables('Approval Status'),'Submitted by Division'),'test1@test.com',if(equals(variables('Approval Status'),'Approved by HR-Finance'),'test2@test.com','test3@test.com'))

    So for first case, the mail will go to test1@test.com, if the choice was "Approved by HR-Finance" the mail will go to test2@test.com, all other choices will go to test3@test.com.

     

    Modify the expression to your needs.

    Cheers!

     edit: if I`m not mistaken, if you use the if() expression to send mails, you can loose the switch case entirely. Just make sure you have a column choice in sharepoint list (radio buttons, in my case). Your flow will send mails according to the choice selected in sharepoint

  • rzaddTDOE Profile Picture
    11 on at

    Hi Mark,

     

    Here are screenshots of what you requested. Details of Approval Status FieldDetails of Approval Status FieldFlor Error 2-12-2.PNGFlor Error 2-12-3.PNG

     

    Let me know if you need anything else to troubleshoot. Thanks!

  • Verified answer
    MarkStokes Profile Picture
    561 on at
    Yep, there you go. “Approval Status” IS an Object.

    But, the screen shot also tells us that there is another value sent to you. That is “Approval Status Value”.

    So if you swap out “Approval Status” for “Approval Status Value” in your switch statement you should be good.

    - Mark
  • CorgiMad Profile Picture
    87 on at

    Hi Mark, 

     

    I'm experiencing a similar issue whereby the value cannot be recognised and the flow is forever running. 

    CorgiMad_1-1693400249260.png

    I added the Compose to pull the 'Delivery Partner Value' - Choice field.

    CorgiMad_0-1693400192521.png

    Any ideas 🤔

     

    Many thanks

    Shelley

  • Bencvalley Profile Picture
    4 on at

    Hi Mark,

    I'm a noob to PA. I have the same issue, but for me the Output from my Choices from the Forms entry adds Brackets which cannot be entered into a switch choice. Instead of email test  it changes to ["email test'] which kills the flow when I enter it. Thanks!Capture.PNG

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 522 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard