Hi,
I have a MS Form where each question has 3 possible answers, "pass" "fail" "n/a." I would like for the result to have three possibilities resulting in two different emails:
1. "Pass" is selected for every question-> Email is sent to group #1
2. A combination of "Pass" and/or "N/A" is selected> Email Sent to group #1
3. "Fail" is selected for any question: Email sent to Group #2.
Currently my results are that if "pass" is selected for every question it emails group #1. If, "N/A" or "Fail"is selected, it goes to Group #1. I am struggling to figure out my conditioning. I have two conditions, seen below.
I would appreciate any help
Hi, @budd5582, if you don't care what the questions are, then you can get the responses to all your questions using some xml and a select.
This one is to make a JSON representation of an XML structure, so that the system can understand it when it converts it to XML.
You can just paste this directly into your compose if you use it, as long as your Get response details is named the same. If you wish to build yours manually, omit the '@{body('Get_response_details')}' part, and select it from your form.
This changes the JSON you made into XML data, then uses the xpath() function to make a special array out of each entry:
This is the main game, and as mentioned previously:
This now gives you an array of all the answer, with this you can do what you wish.
If I were to hazard a guess at the ongoing logic? I would say a Switch action would be your best bet, and use some of the following to get there.
This counts the amount of answers, and removes one, since it's just a summation of everything at the start.
This will gather all answers that are the string 'Pass':
It's important to note that this is just for the string 'Pass', if you've used choices, that data may be represented differently, so you will need to see what a response with Pass looks like, and for 'n/a', and for 'Fail', then use that here.
Make a filter for each choice, and then you can easily make logic to create a switch based on the results therein.
The key here is to get that array of answers, you can do more with that than what you have.
Thank you so much for the detailed response. I'm wondering - do you know of an alternate way for a Form that has almost 40 questions?
Hi @budd5582 ,
You don't require to add multiple conditions action. Find below the steps to know more.
In my case, all my question responses are stored in Compose action.
Now evaluating all the question to check the output.
1- For question 1
Inputs: or(
equals(outputs('Question_1'),'Pass'),
equals(outputs('Question_1'),'NA')
)
simple explanation:
question 1 == Pass OR
question 1 == NA
output will be true if result is either pass or NA else false
2- For question 2 & 3
Inputs :
or(equals(outputs('Question_2'),'Pass'),equals(outputs('Question_2'),'NA'))
or(equals(outputs('Question_3'),'Pass'),equals(outputs('Question_3'),'NA'))
Condition:
Outputs of above compose action which contains expression
Yes:
Send email to group 2
No:
Send email to group 1
Thanks
Vivek Pande
If this post helps answer your question, please "Accept as Solution" to help others find it more quickly.
If you thought this post was helpful, please give it a Thumbs Up.
Subscribe to my YouTube channel to get more interesting content on Power Automate.