Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Using condition to send email and form to printer.

I am using Microsoft forms for collecting pass/fail conditions for an audit. All answers are either Pass or Fail.  Is there a way I can compare every all answer to the fail condition to send an email, or do I need to add a condition for every question?


I would also like to send part of the form to a printer when it fails to alert of what the failure was.   Would that be possible?


Thank you, 

Helper I
Helper I

Do you have an example of your form? It sounds simple, but an example helps understanding the question.


Does your printer has an email address? With my printer I send an email to the printer and this is being printed. That can work for you too.

Frequent Visitor

Here is a snapshot of the flow, all the questions are either PASS or FAIL.  Because I have over 60 questions I wanted to know if there was a choice in the "if then condition"  that would look at all the results from the questions or do I need to add every question into the flow?




Helper I
Helper I

Hi @eric142, here is a solution for you.


After you trigger starts, pull the results by using the 'Get response details' action. Then use a Select (Data Operation).

Use the 'Switch Map to text mode' button to go into text mode.


In the 'From' input, we will convert the result JSON to XML to use it for XPath (thanks to Expiscornovus in another post). Use the string below:


xpath(xml(json(concat('{"Responses":', string(outputs('Get_response_details')?['body']), '}'))), '//Responses/*[text() = "Pass"]')


You notice at the end of the string "Pass". This is the text from the answers in the form we're searching for. This can also be "Fail" or something else if you want to filter on other words.

In the 'Map' input, you use the string below:


substring(base64ToString(item()['$content']), 1, sub(indexOf(base64ToString(item()['$content']), '>'), 1))


The output from the XPath is going to be a base64 unreadable string. This substring will extract the text in the XML node, in this case, the Question IDs. With this array, you can continue your flow, e.g., creating an email.


If you want to get the corresponding question; use the string below and replace

re9f2aefb65084fa090ff2e00da734853 with your Question IDs:





Example of my flow when it ran.

flow example.png


I hope this solution is going to work for you. If so, mark this as Solved.

Thank you.

Frequent Visitor

Hi, @Marco 

In the Map input it is asking for a valid json.  I can't see the flow you attached even when zoomed in it is unreadable to me.


Thank you,


Hi @eric142,


Here is the example of the flow (the other one was the result when it ran).



xpath(xml(json(concat('{"Responses":', string(outputs('Get_response_details')?['body']), '}'))), '//Responses/*[text() = "Pass"]')





substring(base64ToString(item()['$content']), 1, sub(indexOf(base64ToString(item()['$content']), '>'), 1))




Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,967)