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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Using condition to sen...
Power Automate
Unanswered

Using condition to send email and form to printer.

(0) ShareShare
ReportReport
Posted on by 38

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, 

Categories:
I have the same question (0)
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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.

  • eric142 Profile Picture
    38 on at

    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?

     

    FLOW.JPG

    PASS_FAIL QUESTIONS.JPG

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    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:

     

    outputs('Get_response_details')?['body/re9f2aefb65084fa090ff2e00da734853']

     

     

    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.

  • eric142 Profile Picture
    38 on at

    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,

    Eric

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @eric142,

     

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

    From

     

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

     

     

    Map

     

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

     

     

    2021-09-01_13-09-23.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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 552

#2
Valantis Profile Picture

Valantis 388

#3
11manish Profile Picture

11manish 375

Last 30 days Overall leaderboard