I want to be able to send email approvals dynamically depending on what answer the user puts in the question.
This question is quite literally, "pick all people that apply"
So they can pick 1, any 2, any 3, or all 4 options available - and in turn the flow would be able to look at these answers and send an email depending on what they choose above. What is the best way to achieve this?
You could use a switch case. This should solve your issue.
I am familiar with switch cases and use them in other parts of the flow, but since each case requires an "Equals" how do I handle all the permutations that the user can pick?
1) Person 1
2) Person 2
3) Person 3
4) No one
5) Person 1, Person 2
6) Person 1, Person 3
7) Person 2, Person 3
😎 Person 1, Person 2, Person 3
Since this is a multiple answers question on the form, I need to account for all of these. I checked if my variable equals Person 1, Person 2 but when I test it, it fails that switch case. Any thoughts?
Here is a screenshot of what it looks like. There's two switch cases, it enters the first case (green) perfectly fine, but the Orange highlight in variable "a" doesn't seem to like it on switch 2. Always goes to default case
I suggest that the answer to your question depends on what type of approval you intend to create. Do you want to have a separate approval action for each individual selected? If so, then create an array of approvers and put your approval inside of a loop. You'll loop through each element in an array. Also, you'll need to set concurrency control to On for the loop - that way the approvals will execute in a parallel fashion rather than sequentially.
If you want a single approval set to All must approve, then create a semicolon delimited string of the email addresses of the individuals who have been selected. Use that string for the approver.
Thanks for your response. So the answer is that each person in the screenshot (Person 1, Person 2, Person 3) is someone that CAN be selected for approval. It could be any combination of people, but whoever is selected HAS to be sent an approval message. So in the previous picture I posted, I counted a total of 8 permutations so I figured there would need to be 8 cases in a switch control. I tried creating an array of the approvers, but when I run the flow it says the options the user selects are only of type string and can't be put in an array. Since the form itself is a "multiple answer" choice question, I somehow can't reference each person. I think if i knew how to do that I would be golden. Maybe i'm not understanding the delimited string, as I also tried to use the semicolon as the "equals" in the switch case. In that situation, a screenshot of an example would be very helpful.
Three Super User rank tiers have been launched!
Features releasing from October 2020 through March 2021
We've updated and improved the layout and uploading format of the Power Automate Cookbook!
Fill out a quick form to claim your user group badge now!