How can I pull an MS Forms Question text with an expression? I can pull the Answer text from the Get Response body with an expression (Filter null values from a Forms Array ).
When I run a Flow test, the OUTPUTS of Get Response details has this info, but I don't know how to get at it. I am trying to do Select on the outputs on
Solved! Go to Solution.
@brock @Duri @_TJ - I found a way to do this with the 'HTTP AD' connector pointing towards the forms domain. I inspected the network traffic while browsing the forms website in order to find the right endpoint (same as the 'Forms' connector!) and which fields to query for (/questions)
When authenticating I chose the base and service 'https://forms.office.com':
Make sure you choose Invoke HTTP request
And to make it re-usable:
/formapi/api/forms('@{concat(triggerBody()?['resourceData']?['formId'])}')?$expand=questions
^Paste this into the field, not the expression popup.
In the response, questions is an array of objects, each object is a question from the form and it's related properties - most not useful. For each object the property 'id' will match the key for it's response used in the builtin forms connector. Another property of that same object 'title' contains the question text as seen in the form.
That should get the questions and id relationship you're looking for.
I did not need to act on any of the questions, just wanted to pull them for viewing in an email so this may not be useful from here on depending on usecase:
The full schema I used:
{
"type": "object",
"properties": {
"questions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"title": {
"type": "string"
},
"order": {
"type": "integer"
},
"type": {
"type": "string"
},
"required": {
"type": "boolean"
},
"questionInfo": {
"type": "string"
},
"groupId": {},
"status": {
"type": "string"
},
"subtitle": {},
"allowMultipleValues": {},
"trackingId": {
"type": "string"
}
}
}
}
}
}
A loop to tie questions and responses together:
For the apply to each, select 'questions' from dynamic content. This should work but it may become obsolete if the api calls change. You might have to test run the flow to kick the dynamic content to show up.
The first fx body(...) - this should pull the Response based on the id from the current question. The goal is to verify it's not empty.
@{body('Get_response_details')?[items('Apply_to_each')?['id']]}
^Paste this into the field, not the expression popup.
The output of the compose action pipes into the conditional left-hand side as dynamic content
The right hand side should be the expression:
string('')
Leaving the 'if yes' branch empty (meaning 'skip if there is no response to the given question')
I append to my string variable:
"@concat('<b>', items('Apply_to_each')?['title'], '</b> ', body('Get_response_details')?[items('Apply_to_each')?['id']], '<br><br>')"
^Paste this into the field, not the expression popup.
Again - it depends on the usecase, for me this creates a string to nicely fit into emails where the questions are in bold and the response is not. I have two 'breaks' in there for line spacing for readability.
Hopefully this makes sense
Hi @brock
Are the questions your form the same all the time?
Using the model you linked to, if Q1 and Q2 were to output like the following:
Q1: Is this a form? A1: Yes Q2: How cool is this form? A2: 7
Would that be what you are after? Just in plain text, and not dynamically accessing the actual questions?
Thanks, Alan
Proud to be a Flownaut!
The questions in my form may change sometimes (it is a shared form).
I am not completely sure, but I think I am looking to "dynamically access the actual questions".
I want to at least avoid having to type in the question text in my expressions. Of secondary importance is to be able to update the Questions in Forms without having to then modify the Flow experessions.
I would also be grateful for any partial solution to this... plain text or otherwise
Hi @brock ,
I am tring to work on a way to get the dynamic data as Flow displays it but in the "Get response details" action on a successful run. I haven't quite cracked that yet and it may not be possible but I am persevering.
In the mean time, consider the expression below from the other post:
if(equals(not(empty(body('Get_response_details')?['r4b6e28cb8fa748dea068dc564271226e'])), true), concat('Q1: ', body('Get_response_details')?['r4b6e28cb8fa748dea068dc564271226e']), null)
This could become:
if(equals(not(empty(body('Get_response_details')?['r4b6e28cb8fa748dea068dc564271226e'])), true), concat('Date of Birth?: ', body('Get_response_details')?['r4b6e28cb8fa748dea068dc564271226e']), null)
So basically changing "Q1: " to "Date of Birth?: "
This should get the job done and if I can find a way to get at the actual questions from the Form, I will post back.
If you have found my post helpful, please mark thumbs up.
Any other questions, just ask.
Thanks, Alan
Proud to be a Flownaut!
Yes, that is what I am doing now (putting the question text into the concat().
thanks for looking at this, I hope there is a way.
Proud to be a Flownaut!
YYYYYYYY YYYYYYYY EEEEEEEEEEEEEEEEEE SSSSSSSSSSS YYYYYYYY YYYYYYYY EEEEEEEEEEEEEEEEEE SSSSSSSSSSSSS YYYYYYYY YYYYYYYY EEEEEEEEEEEEEEEEEE SSSSSSSSSSSSSSS YYYYYYYY YYYYYYYY EEEEEEEEEEEEEEEEEE SSSSSSSS SSS YYYYYYYY YYYYYYYY EEEEEEEE SSSSSSSS YYYYYYYY YYYYYYYY EEEEEEEE SSSSSSSS YYYYYYYY YYYYYYYY EEEEEEEEEEEEE SSSSSSSS YYYYYYYYYYYYYYYY EEEEEEEEEEEEE SSSSSSSSSS YYYYYYYYYYYYYY EEEEEEEEEEEEE SSSSSSSSSS YYYYYYYYYYYY EEEEEEEEEEEEE SSSSSSSSS YYYYYYYYYY EEEEEEEE SSSSSSSS YYYYYYYY EEEEEEEE SSSSSSSS YYYYYYYY EEEEEEEEEEEEEEEEE SSS SSSSSSSS YYYYYYYY EEEEEEEEEEEEEEEEE SSSSSSSSSSSSSSS YYYYYYYY EEEEEEEEEEEEEEEEE SSSSSSSSSSSSS YYYYYYYY EEEEEEEEEEEEEEEEE SSSSSSSSSSS
Hi @AlanPs1 ,
Do you have an update on this? I also need the questions, coming from the Form. It's a bit frustration, because I know the info is in there, but I can't access it.
Kind regards,
Thye
Hi @AlanPs1
I have browsed a lot and could not find a solution for this. Have you managed to resolve this?
I would be very grateful if you shared your workaround - it would help me a lot.
I will have multiple questionnaires/forms with multiple sections (some filled, some not) - Each single response (which is filled) will make one record (in a database) with an attribute from the question name.
But instead of GUID response form, I need the actual question name (to map it with the proper attribute) - as the questions will be changing over time.
Thanks a lot!
I never found a way to what you want. I ended up putting each question response into a Compose and then building a question/answer table by explicitly stating the question text in my expression. It's problematic when the question text changes or I make a mistake.
@brock @Duri @_TJ - I found a way to do this with the 'HTTP AD' connector pointing towards the forms domain. I inspected the network traffic while browsing the forms website in order to find the right endpoint (same as the 'Forms' connector!) and which fields to query for (/questions)
When authenticating I chose the base and service 'https://forms.office.com':
Make sure you choose Invoke HTTP request
And to make it re-usable:
/formapi/api/forms('@{concat(triggerBody()?['resourceData']?['formId'])}')?$expand=questions
^Paste this into the field, not the expression popup.
In the response, questions is an array of objects, each object is a question from the form and it's related properties - most not useful. For each object the property 'id' will match the key for it's response used in the builtin forms connector. Another property of that same object 'title' contains the question text as seen in the form.
That should get the questions and id relationship you're looking for.
I did not need to act on any of the questions, just wanted to pull them for viewing in an email so this may not be useful from here on depending on usecase:
The full schema I used:
{
"type": "object",
"properties": {
"questions": {
"type": "array",
"items": {
"type": "object",
"properties": {
"id": {
"type": "string"
},
"title": {
"type": "string"
},
"order": {
"type": "integer"
},
"type": {
"type": "string"
},
"required": {
"type": "boolean"
},
"questionInfo": {
"type": "string"
},
"groupId": {},
"status": {
"type": "string"
},
"subtitle": {},
"allowMultipleValues": {},
"trackingId": {
"type": "string"
}
}
}
}
}
}
A loop to tie questions and responses together:
For the apply to each, select 'questions' from dynamic content. This should work but it may become obsolete if the api calls change. You might have to test run the flow to kick the dynamic content to show up.
The first fx body(...) - this should pull the Response based on the id from the current question. The goal is to verify it's not empty.
@{body('Get_response_details')?[items('Apply_to_each')?['id']]}
^Paste this into the field, not the expression popup.
The output of the compose action pipes into the conditional left-hand side as dynamic content
The right hand side should be the expression:
string('')
Leaving the 'if yes' branch empty (meaning 'skip if there is no response to the given question')
I append to my string variable:
"@concat('<b>', items('Apply_to_each')?['title'], '</b> ', body('Get_response_details')?[items('Apply_to_each')?['id']], '<br><br>')"
^Paste this into the field, not the expression popup.
Again - it depends on the usecase, for me this creates a string to nicely fit into emails where the questions are in bold and the response is not. I have two 'breaks' in there for line spacing for readability.
Hopefully this makes sense
@Demaul Thanks for putting together this amazing solution! The HTTP with Azure AD is a premium connector though. Any thoughts on being able to do this using a non-premium connector? We really just need a one time dump of the question id and question mapping so any other suggestions will be helpful too. I am working with a client and dont have access to their Azure environment otherwise logic apps would also have been an option for a one time mapping. Thoughts on what else I can use to at least get a one time mapping? Thanks again for the nice solution!
This was very helpful, thanks for putting it out! Can you please elaborate on how to create JSON template that MS Flow can parse? I fail at this step. Thanks!
Adding to @Demaul 's post above and great work by the way, I played around with the Data Operation - Select, and came up with following solution: (going into details below)
Here's the output from the Forms 'Get Response Details' with the question ids and corresponding answers.
Here's the results of the 'Invoke an HTTP request' which shows the array of questions with "id" matching the answer above, and the "title" which is the actual question literal
It may help to think of the "Select" action in a similar way to "Apply to Each" action or "For each" in other scripting languages, but "Select" performs changes across items in the array in one action.
From the the entire outputs above we only need to iterate through "questions" array, so we append ?['questions'] to the outputs body like so:
We can then address each item() directly so:
Question = item()?['title']
For the Answer, we need to look for the item()?['id'] within the body of the outputs from Get Response Details, so:
Answer = body('Get_response_details')?[item()?['id']]
The outputs of the Select action gives us a nice array of Question and Answer:
This array can be used to Create HTML table or Create CSV table. The output of these can simply be added to an email body or attached as a csv file.
Hope this is helpful to someone
Hi @Demaul
I am trying to group the questions by sections, but I can't find the property for that. I found the property "groupId" but I noticed that just the MatrixChoice questions have a value, the others are Null.
Can you help me please? Thank you
@Demaul Thanks for the solution. This is working fine till 22nd July. Suddenly I'm getting below error.
I am also getting the same issue. Property 'questions' cannot be used in the $expand query option. Can someone help us with this?
Thank you
Yeah me too face the same issue please help on us.
Temp Fix : It works for me
/formapi/api/[Tenant ID]/users/[Form creator oid]/light/runtimeFormsWithResponses('@{concat(triggerBody()?['resourceData']?['formId'])}')?$expand=questions
Super Users – 2023 Season 1 We are excited to kick off the Power Users Super User Program for 2023 - Season 1. The Power Platform Super Users have done an amazing job in keeping the Power Platform communities helpful, accurate and responsive. We would like to send these amazing folks a big THANK YOU for their efforts. Super User Season 1 | Contributions July 1, 2022 – December 31, 2022 Super User Season 2 | Contributions January 1, 2023 – June 30, 2023 Curious what a Super User is? Super Users are especially active community members who are eager to help others with their community questions. There are 2 Super User seasons in a year, and we monitor the community for new potential Super Users at the end of each season. Super Users are recognized in the community with both a rank name and icon next to their username, and a seasonal badge on their profile. Power Apps Power Automate Power Virtual Agents Power Pages Pstork1* Pstork1* Pstork1* OliverRodrigues BCBuizer Expiscornovus* Expiscornovus* ragavanrajan AhmedSalih grantjenkins renatoromao Mira_Ghaly* Mira_Ghaly* Sundeep_Malik* Sundeep_Malik* SudeepGhatakNZ* SudeepGhatakNZ* StretchFredrik* StretchFredrik* 365-Assist* 365-Assist* cha_cha ekarim2020 timl Hardesh15 iAm_ManCat annajhaveri SebS Rhiassuring LaurensM abm TheRobRush Ankesh_49 WiZey lbendlin Nogueira1306 Kaif_Siddique victorcp RobElliott dpoggemann srduval SBax CFernandes Roverandom schwibach Akser CraigStewart PowerRanger MichaelAnnis subsguts David_MA EricRegnier edgonzales zmansuri GeorgiosG ChrisPiasecki ryule AmDev fchopo phipps0218 tom_riha theapurva takolota Akash17 momlo BCLS776 Shuvam-rpa rampprakash ScottShearer Rusk ChristianAbata cchannon Koen5 a33ik AaronKnox Matren Alex_10 Jeff_Thorpe poweractivate Ramole DianaBirkelbach DavidZoon AJ_Z PriyankaGeethik BrianS StalinPonnusamy HamidBee CNT Anonymous_Hippo Anchov KeithAtherton alaabitar Tolu_Victor KRider sperry1625 IPC_ahaas zuurg rubin_boer cwebb365 If an * is at the end of a user's name this means they are a Multi Super User, in more than one community. Please note this is not the final list, as we are pending a few acceptances. Once they are received the list will be updated.
Welcome to our March 2023 Newsletter, where we'll be highlighting the great work of our members within our Biz Apps communities, alongside the latest news, video releases, and upcoming events. If you're new to the community, be sure to subscribe to the News & Announcements and stay up to date with the latest news from our ever-growing membership network who find real "Power in the Community". LATEST NEWS Power Platform Connections Check out Episode Five of Power Platform Connections, as David Warner II and Hugo Bernier chat with #PowerAutomate Vice President, Stephen Siciliano, alongside reviewing out the great work of Vesa Juvonen, Waldek Mastykarz, Maximilian Müller, Kristine Kolodziejski, Danish Naglekar, Cat Schneider, Victor Dantas, and many more. Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show! Did you miss an episode? Catch up now in the Community Connections Galleries Power Apps, Power Automate, Power Virtual Agents, Power Pages Power Platform leading a new era of AI-generated low-code development. **HOT OFF THE PRESS** Fantastic piece here by Charles Lamanna on how we're reinventing software development with Copilot in Power Platform to help you can build apps, flows, and bots with just a simple description! Click here to see the Product Blog Copilot for Power Apps - Power CAT Live To follow on from Charles' blog, check out #PowerCATLive as Phil Topness gives Clay Wesener Wesner a tour of the capabilities of Copilot in Power Apps. UPCOMING EVENTS Modern Workplace Conference Check out the Power Platform and Microsoft 365 Modern Workplace Conference that returns face-to-face at the Espace St Martin in Paris on 27-28th March. The #MWCP23 will feature a wide range of expert speakers, including Nadia Yahiaoui, Amanda Sterner, Pierre-Henri, Chirag Patel, Chris Hoard, Edyta Gorzoń, Erika Beaumier, Estelle Auberix, Femke Cornelissen, Frank POIREAU, Gaëlle Moreau, Gilles Pommier, Ilya Fainberg, Julie Ecolivet, Mai-Lynn Lien, Marijn Somers, Merethe Stave, Nikki Chapple, Patrick Guimonet, Penda Sow, Pieter Op De Beéck, Rémi Riche, Robin Doudoux, Stéphanie Delcroix, Yves Habersaat and many more. Click here to find out more and register today! Business Applications Launch 2023 Join us on Tuesday 4th April 2023 for an in-depth look into the latest updates across Microsoft Power Platform and Microsoft Dynamics 365 that are helping businesses overcome their biggest challenges today. Find out about new features, capabilities, and best practices for connecting data to deliver exceptional customer experiences, collaborating and creating using AI-powered capabilities, driving productivity with automation, and building future growth with today’s leading technology. Click Here to Register Today! Power Platform Conference 2023 We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5th, 2023! But first, let's take a look below at some fun moments from MPPC 2022 in Orlando Florida. 2023 sees guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, and many more taking part, so why not click the link below to register for the #PowerPlatformConf today! Vegas, baby! Click Here to Register Today! COMMUNITY HIGHLIGHTS Check out our top Super and Community Users reaching new levels! These hardworking members are posting, answering questions, kudos, and providing top solutions in their communities. Power Apps: Super Users: @WarrenBelz | @iAm_ManCat Community Users: @LaurensM | @Rusk | @RJM07 Power Automate: Super Users: @abm | @Expiscornovus | @RobElliott Community Users: @grantjenkins | @Chriddle Power Virtual Agents: Super Users: @Expiscornovus | @Pstork1 Community Users: @MisterBates | @Jupyter123 | Kunal K Power Pages: Super Users: @OliverRodriguesOliverRodrigues | @Mira_Ghaly Community Users: @FubarFubar | @ianwukianwuk LATEST PRODUCT BLOG ARTICLES Power Apps Community Blog Power Automate Community Blog Power Virtual Agents Community Blog Power Pages Community Blog Check out 'Using the Community' for more helpful tips and information: Power Apps, Power Automate, Power Virtual Agents, Power Pages
Join us for an in-depth look into the latest updates across Microsoft Dynamics 365 and Microsoft Power Platform that are helping businesses overcome their biggest challenges today. Find out about new features, capabilities, and best practices for connecting data to deliver exceptional customer experiences, collaborating, and creating using AI-powered capabilities, driving productivity with automation—and building towards future growth with today’s leading technology. Microsoft leaders and experts will guide you through the full 2023 release wave 1 and how these advancements will help you: Expand visibility, reduce time, and enhance creativity in your departments and teams with unified, AI-powered capabilities.Empower your employees to focus on revenue-generating tasks while automating repetitive tasks.Connect people, data, and processes across your organization with modern collaboration tools.Innovate without limits using the latest in low-code development, including new GPT-powered capabilities. Click Here to Register Today!
Episode Five of Power Platform Connections sees David Warner and Hugo Bernier talk to Vice President of Power Automate, Stephen Siciliano, alongside the latest news, product reviews, and community blogs. Use the hashtag #PowerPlatformConnects on social media for a chance to have your work featured on the show! Show schedule in this episode: 0:00 Cold Open 0:34 Show Intro 01:09 Stephen Siciliano Interview 30:42 Blogs & Articles 31:06 PnP Weekly Ep 200 32:51 SharePoint Custom Form Backup 33:38 Power Apps Extreme Makeover 34:56 ChatGPT Control 35:35 Color Data 37:17 Top 7 Features on Dynamics 365 2023 Release Wave 1 38:30 Outro & Bloopers Check out the blogs and articles featured in this week’s episode: https://pnp.github.io/blog/microsoft-365-pnp-weekly/episode-200/ (no tags) https://grazfuchs.net/post/sharepoint-customform-backup/ @Maximilian Müllerhttps://www.fromzerotoheroes.com/ @Kristine Kolodziejski https://github.com/Power-Maverick/PCF-Controls/tree/master/ChatGPTControl @DanzMaverick https://yerawizardcat.com/color/ @CatSchneider https://events.powercommunity.com/dynamics-power-israel/ @VictorDantas Action requested: Feel free to provide feedback on how we can make our community more inclusive and diverse. This episode premiered live on our YouTube at 12pm PST on Thursday, 16th March 2023. Video series available at Power Platform Community YouTube channel. Upcoming events: Business Applications Launch – April 4th – Free and Virtual! M365 Conference - May 1-5th - Las Vegas Power Apps Developers Summit – May 19-20th - London European Power Platform conference – Jun. 20-22nd - Dublin Microsoft Power Platform Conference – Oct. 3-5th - Las Vegas Join our Communities: Power Apps Community Power Automate Community Power Virtual Agents Community Power Pages Community If you’d like to hear from a specific community member in an upcoming recording and/or have specific questions for the Power Platform Connections team, please let us know. We will do our best to address all your requests or questions.
We are excited to share the ‘Power Platform Communities Front Door’ experience with you! Front Door brings together content from all the Power Platform communities into a single place for our community members, customers and low-code, no-code enthusiasts to learn, share and engage with peers, advocates, community program managers and our product team members. There are a host of features and new capabilities now available on Power Platform Communities Front Door to make content more discoverable for all power product community users which includes ForumsUser GroupsEventsCommunity highlightsCommunity by numbersLinks to all communities Users can see top discussions from across all the Power Platform communities and easily navigate to the latest or trending posts for further interaction. Additionally, they can filter to individual products as well. Users can filter and browse the user group events from all power platform products with feature parity to existing community user group experience and added filtering capabilities. Users can now explore user groups on the Power Platform Front Door landing page with capability to view all products in Power Platform. Explore Power Platform Communities Front Door today. Visit Power Platform Community Front door to easily navigate to the different product communities, view a roll up of user groups, events and forums.
We are so excited to see you for the Microsoft Power Platform Conference in Las Vegas October 3-5 2023! But first, let's take a look back at some fun moments and the best community in tech from MPPC 2022 in Orlando, Florida. Featuring guest speakers such as Charles Lamanna, Heather Cook, Julie Strauss, Nirav Shah, Ryan Cunningham, Sangya Singh, Stephen Siciliano, Hugo Bernier and many more. Register today: https://www.powerplatformconf.com/
User | Count |
---|---|
93 | |
38 | |
28 | |
18 | |
13 |
User | Count |
---|---|
131 | |
56 | |
41 | |
32 | |
24 |