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

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How to write an expres...
Power Automate
Answered

How to write an expression to retrieve answer

(0) ShareShare
ReportReport
Posted on by 69

Hi, 

I am connecting to a SurveyMonkey survey, which unfortunately does not give me dynamic fields to I can extract answers.  I am guessing there must be a way to write an expression.

For instance, one this one question we have the respondent select their county.

I want to extract that answer so I can email the response to the correct area.

I am just not savvy enough with expressions to do that.

Is this possible?

Here is the JSON data for that field:

{

    "id": "753498214",

    "answers": [

      {

        "choice_id": "4963767255",

        "simple_text": "Williamson"

      }

    ],

    "family": "single_choice",

    "subtype": "menu",

    "heading": "County where the problem is occurring:"

  }

Categories:
I have the same question (0)
  • Verified answer
    Sundeep_Malik Profile Picture
    6,484 on at

    Hey @Bcnewton 

     

    Saved your above data in a compose action.

    Sundeep_Malik_0-1673345434708.png

     

    Then wrote this expression:

    To get choice_id:

    outputs('Compose')?['answers']?[0]?['choice_id']

    To get simple_text:

    outputs('Compose')?['answers']?[0]?['simple_text']
    Sundeep_Malik_1-1673345499769.png

     

    Output:

     

    Sundeep_Malik_2-1673345548603.png

     

    Sundeep_Malik_3-1673345561665.png

     

    You can use the above expressions but I would also suggest to once see Parse Json action. 

     

    Giving you a video for it:

    https://www.youtube.com/watch?v=e0dzMqoJGtY

     

    I hope this helps 🙂

  • Bcnewton Profile Picture
    69 on at

    Oh my gosh! You are brilliant! Thanks so much!

  • Bcnewton Profile Picture
    69 on at

    @Sundeep_Malik 

    I did also want to say I always use Parse JSON, but that really wasn't helping me with the SurveyMonkey content. Great for MS Forms and SharePoint.

     

    Sundeep, is it possible you could also tell me how to change that to retrieve multiple answers?  Like this one?

      "questions": [

        {

          "id": "775374019",

          "answers": [

            {

              "choice_id": "5134924258",

              "simple_text": "Environmental"

            },

            {

              "choice_id": "5134924263",

              "simple_text": "Spill"

            },

            {

              "choice_id": "5134924264",

              "simple_text": "Air/Odor"

            }

          ]

     "questions": [

        {

          "id": "775374019",

          "answers": [

            {

              "choice_id": "5134924263",

              "simple_text": "Spill"

            },

            {

              "choice_id": "5134924264",

              "simple_text": "Air/Odor"

            }

          ]

  • Bcnewton Profile Picture
    69 on at

    @Sundeep_Malik 

    I thought this worked but it keeps giving me only what we put into the compose, not the new content when a new form is filled out.  Can you tell me a way around that?

  • Sundeep_Malik Profile Picture
    6,484 on at

    @Bcnewton 

    Pass whatever you are getting from form to that compose.

    If this does not work, can you share your flow in edit mode, I want to see what you have done, then only I will be able to help.

  • Bcnewton Profile Picture
    69 on at

     

     

     

     

     

     

     

     

     

     

     

     

    @Sundeep_Malik 

    My whole Parse JSON is below, but I was needing to extract individual fields each time someone new fill in the form.  

    Bcnewton_0-1674155377604.png

     

    {

      "id": "19016060002",

      "recipient_id": "",

      "collection_mode": "default",

      "response_status": "completed",

      "custom_value": "",

      "first_name": "",

      "last_name": "",

      "email_address": "",

      "ip_address": "000.000.000.000",

      "logic_path": {},

      "metadata": {

        "respondent": {

          "user_agent": {

            "type": "number",

            "value": 47787771

          },

          "language": {

            "type": "string",

            "value": "en"

          }

        },

        "contact": {}

      },

      "page_path": [],

      "collector_id": "417479618",

      "survey_id": "317053299",

      "custom_variables": {},

      "edit_url": "https://privateurl",

      "analyze_url": " https://privateurl ",

      "total_time": 130,

      "date_modified": "2023-01-17T18:28:57+00:00",

      "date_created": "2023-01-17T18:26:47+00:00",

      "href": "https://api.surveymonkey.net/privatelink",

      "questions": [

        {

          "id": "775374019",

          "answers": [

            {

              "choice_id": "5134924260",

              "simple_text": "Oil and Gas"

            },

            {

              "choice_id": "5134924263",

              "simple_text": "Spill"

            }

          ],

          "family": "multiple_choice",

          "subtype": "vertical",

          "heading": "Nature of the complaint affecting you? (Select one or more)"

        },

        {

          "id": "753404146",

          "answers": [

            {

              "row_id": "4962757245",

              "tag_data": [],

              "text": "01/17/2023 4:30 AM",

              "simple_text": "\n    Date / Time\n | 01/17/2023 4:30 AM"

            }

          ],

          "family": "datetime",

          "subtype": "both",

          "heading": "Date and approximate time observed:"

        },

        {

          "id": "775373970",

          "answers": [

            {

              "choice_id": "5134923723",

              "simple_text": "Yes"

            }

          ],

          "family": "single_choice",

          "subtype": "vertical",

          "heading": "Is the problem still ongoing?"

        },

        {

          "id": "753404507",

          "answers": [

            {

              "tag_data": [],

              "text": "Leander TX 78641",

              "simple_text": "Leander TX 78641"

            }

          ],

          "family": "open_ended",

          "subtype": "single",

          "heading": "Optional: Address or description of the location where the problem is occurring:"

        },

        {

          "id": "775402329",

          "answers": [

            {

              "tag_data": [],

               "text": "Longitude: -97.85286 Latitude 30.578661",

              "simple_text": " Longitude: -97.85286 Latitude 30.578661"

            }

          ],

          "family": "open_ended",

          "subtype": "single",

          "heading": "Optional: Providing the Lat/Long or the GPS Coordinates below can help us pinpoint the location of the complaint.  You could use this link to find that information. The following link will open in a new tab, so you will not lose your place on the form.<br><a href=\"https://www.tceq.texas.gov/gis/hb-610-viewer\" rel=\"nofollow\" target=\"_blank\">https://www.tceq.texas.gov/gis/hb-610-viewer</a>"

        },

        {

          "id": "775400858",

          "answers": [

            {

              "tag_data": [],

              "text": "78641",

              "simple_text": "78641"

            }

          ],

          "family": "open_ended",

          "subtype": "single",

          "heading": "Please provide a 5-digit zipcode of location where problem is occurring."

        },

        {

          "id": "753498214",

          "answers": [

            {

              "choice_id": "4963646247",

              "simple_text": "Angelina"

            }

          ],

          "family": "single_choice",

          "subtype": "menu",

          "heading": "County where the problem is occurring:"

        },

        {

          "id": "753408827",

          "answers": [

            {

              "tag_data": [],

              "text": "testing Angelina",

              "simple_text": "testing Angelina"

            }

          ],

          "family": "open_ended",

          "subtype": "essay",

          "heading": "Who or what you believe is the source of the problem:  If this is already a regulated entity, you may wish to reference the facility or customer name or number here:  <a href=\"https://www15.tceq.texas.gov/crpub/\" rel=\"nofollow\" target=\"_blank\">TCEQ Central Registry Query (texas.gov)</a>"

        },

        {

          "id": "753408994",

          "answers": [

            {

              "tag_data": [

                {

                  "hexcolor": "F9BE00",

                  "label": "sm_neutral",

                  "tag_type": "sentiment"

                }

              ],

              "text": "testing the flow",

              "simple_text": "testing the flow"

            }

          ],

          "family": "open_ended",

          "subtype": "essay",

          "heading": "A brief description of the problem:"

        },

        {

          "id": "753410051",

          "answers": [

            {

              "content_type": "image/jpeg",

              "tag_data": [],

              "text": "06052015-002.jpg",

              "download_url": "removed private download url",

              "human_download_url": "removed private human download url",

              "simple_text": "06052015-002.jpg"

            }

          ],

          "family": "open_ended",

          "subtype": "single",

          "heading": "Upload with the <em>Choose File</em> button below."

        },

        {

          "id": "753410763",

          "answers": [

            {

              "row_id": "4962801276",

              "tag_data": [],

              "text": "Bess ",

              "simple_text": "\n              Name\n             | Bess "

            },

            {

              "row_id": "4962801285",

              "tag_data": [],

              "text": "000.000.0000",

              "simple_text": "\n              Phone Number\n             | 000.000.0000"

            }

          ],

          "family": "demographic",

          "subtype": "us",

          "heading": "Provide whatever level of information that you would like to share for us to be able to respond directly to you."

        },

        {

          "id": "775374094",

          "answers": [

            {

              "choice_id": "000.000.0000",

              "simple_text": "Phone"

            }

          ],

          "family": "single_choice",

          "subtype": "vertical",

          "heading": "How do you prefer we contact you?"

        }

      ]

    }

     

     

     

  • Sundeep_Malik Profile Picture
    6,484 on at

    Hey @Bcnewton 

     

    Sorry for the late reply, was a lot busy this week.

    I copied the same data in my flow, got a parse json error and the error has no description, so not sure why its failing. 

    I will suggest you one thing. 

    Once fill the whole form, every answer, keep nothing null. Now pass it to the flow. Use parse json action, that will take out fields individually for you. 

  • Bcnewton Profile Picture
    69 on at

    Hi @Sundeep_Malik 

    Thanks for looking again.  Here is further clarification of what I am attempting.

     

    I have filled out every field in the form. And to clarify, what I am attempting to do, is when someone fills out a new SurveyMonkey survey, the information will update with that new info.  The other compose actions we tried just kept the info given in compose.  My goal is to have the question and the answer connected and extracted individually to add to a SharePoint list and also to provide logic so that the response is sent to the correct person.  My other goal is to create an automated response to the person who completed the survey if they provided their information.

     

    Currently can’t extract dynamic values out of the SurveyMonkey connector. IDs are not useful because they change every time as well.

    I need to be able to associate all answers with their question headings.

    I want to be able to send an email that says something like this and also add to columns in SharePoint:

    Here are the details of the complaint:

    Nature of the complaint: Health, Property, Spill

    Date observed: 1/30/2023

    Time: 5:00 AM

    Is the problem still ongoing? The problem is ongoing.

    Date if no longer ongoing: N/A

    Address or description of the location where the problem is occurring: 100 Main St

    Lat/Long: 28.41738° N, -97.74118° E

    5-digit zip code of location where problem is occurring. 79721

    County where the problem is occurring:  Bee County

    Source of the problem: Hatfield

    A brief description of the problem: I believe Hatfield dumped his waste on my property.  

    File added: https://www.surveymonkey.com/analyze/files/download/?survey_id=405235562&files=SXWswWIGBMlw_2FlPD0qwQuji2ohY3NdLp3Go4PBJ_2F2IdlGHQ_2BLsmSsgc2haXWuWtZWM3PTadBd8qD1_2FV2gPRy0RelJbbMtpRX9IPdjQRFv9dVB824CLNVtcj6ibvubDcnpnN9r_2Fxlg28viHYxFahcsvczAGflEHopdgelY5XDcQo_3D

    Contact me with updates.

    If you are providing information, what is your preferred way of contact? By email

    Contact Information

    Name: Bess New

    Email Address bess.new@somedomain.com

    Address: 100 Main St

    City/Town: Beeville

    ZIP/Postal Code: 78102

     

    Here is the Body return from Parse JSON.

    {

      "id": "114232525361",

      "recipient_id": "",

      "collection_mode": "default",

      "response_status": "completed",

      "custom_value": "",

      "first_name": "",

      "last_name": "",

      "email_address": "",

      "ip_address": ",

      "logic_path": {},

      "metadata": {

        "respondent": {

          "user_agent": {

            "type": "number",

            "value": 4357112

          },

          "language": {

            "type": "string",

            "value": "en"

          }

        },

        "contact": {}

      },

      "page_path": [],

      "collector_id": "424458087",

      "survey_id": "405235562",

      "custom_variables": {},

      "edit_url": "https://www.surveymonkey.com/r/?sm=5P1AY8iqtZoPTDvbzRnkbjPGE76pm_2B9juiGnbvxzlGxUuG_2BrafyuIZZTa0Gki3VB",

      "analyze_url": "https://www.surveymonkey.com/analyze/browse/WFYeH6abPZzlaL_2B40vl7W3Nff_2FPZ6BGuxbparZPU4uI_3D?respondent_id=114232525361",

      "total_time": 335,

      "date_modified": "2023-01-30T16:53:59+00:00",

      "date_created": "2023-01-30T16:48:24+00:00",

      "href": "https://api.surveymonkey.net/v3/surveys/405235562/responses/114232525361",

      "questions": [

        {

          "id": "110494036",

          "answers": [

            {

              "choice_id": "838349127",

              "simple_text": "Health"

            },

            {

              "choice_id": "838349130",

              "simple_text": "Property"

            },

            {

              "choice_id": "838349131",

              "simple_text": "Spill"

            }

          ],

          "family": "multiple_choice",

          "subtype": "vertical",

          "heading": "Nature of the complaint affecting you? (Select one or more)"

        },

        {

          "id": "110494028",

          "answers": [

            {

              "row_id": "838348844",

              "tag_data": [],

              "text": "01/30/2023",

              "simple_text": "Enter Date Observed | 01/30/2023"

            }

          ],

          "family": "datetime",

          "subtype": "date_only",

          "heading": "Date observed:"

        },

        {

          "id": "113885909",

          "answers": [

            {

              "row_id": "861338938",

              "tag_data": [],

              "text": "5:00 AM",

              "simple_text": "Time | 5:00 AM"

            }

          ],

          "family": "datetime",

          "subtype": "time_only",

          "heading": "Approximate Time Observed"

        },

        {

          "id": "110494035",

          "answers": [

            {

              "choice_id": "838349122",

              "simple_text": "The problem is ongoing"

            },

            {

              "other_id": "838349148",

              "text": "N/A",

              "simple_text": "Other | N/A"

            }

          ],

          "family": "single_choice",

          "subtype": "vertical",

          "heading": "Is the problem still ongoing?"

        },

        {

          "id": "110494029",

          "answers": [

            {

              "tag_data": [],

              "text": "101 Main St",

              "simple_text": "101 Main St"

            }

          ],

          "family": "open_ended",

          "subtype": "single",

          "heading": "Address or description of the location where the problem is occurring:"

        },

        {

          "id": "110494039",

          "answers": [

            {

              "tag_data": [],

              "text": "28.41738° N, -97.74118° E",

              "simple_text": "28.41738° N, -97.74118° E"

            }

          ],

          "family": "open_ended",

          "subtype": "single",

          "heading": "Lat/Long"

        },

        {

          "id": "113888061",

          "answers": [

            {

              "row_id": "861352582",

              "tag_data": [],

              "text": "78102",

              "simple_text": "\n              ZIP/Postal Code\n             | 78102"

            }

          ],

          "family": "demographic",

          "subtype": "international",

          "heading": "Please provide a 5-digit zipcode of location where problem is occurring."

        },

        {

          "id": "113946971",

          "answers": [

            {

              "choice_id": "861734686",

              "simple_text": "Bee County"

            }

          ],

          "family": "single_choice",

          "subtype": "menu",

          "heading": "County where the problem is occurring:"

        },

        {

          "id": "110494030",

          "answers": [

            {

              "tag_data": [],

              "text": "Hatfield",

              "simple_text": "Hatfield"

            }

          ],

          "family": "open_ended",

          "subtype": "essay",

          "heading": "Who or what you believe is the source of the problem:  If this is already a regulated entity, you may wish to reference the facility or customer name or number here:  <a href=\"https://www15.tceq.texas.gov/crpub/\" rel=\"nofollow\" target=\"_blank\">TCEQ Central Registry Query (texas.gov)</a>"

        },

        {

          "id": "110494031",

          "answers": [

            {

              "tag_data": [],

              "text": "I believe Hatfield dumped his waste on my property.",

              "simple_text": "I believe Hatfield dumped his waste on my property."

            }

          ],

          "family": "open_ended",

          "subtype": "essay",

          "heading": "A brief description of the problem:"

        },

        {

          "id": "110494032",

          "answers": [

            {

              "content_type": "image/jpeg",

              "tag_data": [],

              "text": "waste.jpg",

              "download_url": "https://sm-fileupload.s3.amazonaws.com/82de57f9-bb31-4eae-b5b9-d315aee4f222.jpg?response-content-disposition=attachment%3B%20filename%2A%3DUTF-8%27%27waste.jpg&response-content-type=image%2Fjpeg&X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=ASIAQMVQNXI65NPPEJPY%2F20230130%2Fus-west-1%2Fs3%2Faws4_request&X-Amz-Date=20230130T165440Z&X-Amz-Expires=42300&X-Amz-SignedHeaders=host&X-Amz-Security-Token=FwoGZXIvYXdzECoaDJciQ8fTztukw4cGKyLCAXqT4DbH7HFmnZSQdI2C%2BS4I7niQEyTASWUkFqAx47tjmjAPszqTMcQr7LnC3UgGomL3aKZXpZWKYAfor5qFkLCK2VJPE6DCKl%2FzisQTCIqHk1JHq1JNyQgF%2BeDfPNRkiBcGj19SqlMPwDrw%2FvxcXHV%2BrPhcxUzOq6acTou8b7WryqcFOxj7UUdlu3mzrzswQdDzNaqKguu1AmvkQ9sjXxHHc74HIxIE5ZZyjMM0By8uIJ8QLY9NFRNpYrhbPeFwm9z4KM%2Fs354GMi3rakoccdWAuTi4SkmQFeH5dYEiGOst16%2FMb22mgVB3YZtvSyDPzDLJuB0KOGw%3D&X-Amz-Signature=e1d8a62c205a80c1ef7e46899b7382e3dac575b165a77c8ca3257a0f0444c7b5",

              "human_download_url": "https://www.surveymonkey.com/analyze/files/download/?survey_id=405235562&files=SXWswWIGBMlw_2FlPD0qwQuji2ohY3NdLp3Go4PBJ_2F2IdlGHQ_2BLsmSsgc2haXWuWtZWM3PTadBd8qD1_2FV2gPRy0RelJbbMtpRX9IPdjQRFv9dVB824CLNVtcj6ibvubDcnpnN9r_2Fxlg28viHYxFahcsvczAGflEHopdgelY5XDcQo_3D",

              "simple_text": "waste.jpg"

            }

          ],

          "family": "open_ended",

          "subtype": "single",

          "heading": "Are you providing information or evidence?  Information can help us more effectively investigate your concern.  In order for us to use information or evidence you submit in an enforcement action, you must follow strict agency procedures for gathering and preserving the information or evidence you submit. Please review this information:  <a href=\"https://www.tceq.texas.gov/compliance/complaints/handle_complaint.html\" rel=\"nofollow\" target=\"_blank\"> How the TCEQ Handles Environmental Complaints - Texas Commission on Environmental Quality - www.tceq.texas.gov </a><br>Upload with the <em>Choose File</em> button below."

        },

        {

          "id": "113906757",

          "answers": [

            {

              "choice_id": "861477383",

              "simple_text": "Contact me with updates."

            }

          ],

          "family": "single_choice",

          "subtype": "vertical",

          "heading": "Would you like to provide information for us to contact you?"

        },

        {

          "id": "113899475",

          "answers": [

            {

              "choice_id": "861428502",

              "simple_text": "By email"

            }

          ],

          "family": "single_choice",

          "subtype": "vertical",

          "heading": "If you are providing information, what is your preferred way of contact?"

        },

        {

          "id": "113918663",

          "answers": [

            {

              "row_id": "861554269",

              "tag_data": [],

              "text": "Bess New",

              "simple_text": "\n              Name\n             | Bess New"

            },

            {

              "row_id": "861554271",

              "tag_data": [],

              "text": "100 Main St",

              "simple_text": "\n              Address\n             | 100 Main St"

            },

            {

              "row_id": "861554273",

              "tag_data": [],

              "text": "Beeville",

              "simple_text": "\n              City/Town\n             | Beeville"

            },

            {

              "row_id": "861554275",

              "tag_data": [],

              "text": "78102",

              "simple_text": "\n              ZIP/Postal Code\n             | 78102"

            },

            {

              "row_id": "861554277",

              "tag_data": [],

              "text": "bess@someDomain.com",

              "simple_text": "\n              Email Address\n             | bess@someDomain.com"

            },

            {

              "row_id": "861554278",

              "tag_data": [],

              "text": "5555555555",

              "simple_text": "\n              Phone Number\n             | 5555555555"

            }

          ],

          "family": "demographic",

          "subtype": "international",

          "heading": "Contact Information"

        }

      ]

    }

     

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!

Leaderboard > Power Automate

#1
trice602 Profile Picture

trice602 237 Super User 2026 Season 1

#2
David_MA Profile Picture

David_MA 173 Super User 2026 Season 1

#3
Kalathiya Profile Picture

Kalathiya 95 Super User 2026 Season 1

Last 30 days Overall leaderboard