*** NOTE: ALL INFORMATION IS ACCURATE AT DATE OF PUBLISHING ***

Microsoft is continually making changes to Dynamics 365 Customer Voice. This includes new functionality that’s immediate and noticeable and sometimes comes in the form of a simple new field that allows us to do so much more. The Details of the Survey Response or msfp_questionresponseslist field is one such field. In this post let’s dig in to see what it contains, and how we can leverage to send notifications with all of the question responses when a new survey response is received.

If you are using a Model-driven Power App, you can get access to the Details of the Survey Response field by adding it to a Survey Response form.

The JSON data stored in this field is a combination of a question id value along with the response given to that related question.

[{"questionId":"rdf7e3aa9845e44f09cda5fd5d7f361ab","response":"Jane"},{"questionId":"r69f624974be14d27833de98b88789e99","response":"Doe"},{"questionId":"rc89fc12228994cca8859ee52d603764b","response":"janecontactdoe@gmail.com"},{"questionId":"r71a563df4d834de99b26bea21ee6f5dd","response":"5"},{"questionId":"r7b6d88e115c64d50aae01da4e2062ee8","response":"9"}]

If we look at the Customer Voice survey question record, we can see the Source question identifier, which is the field used in the JSON.

We can use the msfp_questionresponseslist in Power Automate to then get access to the question responses and take action on the data in a couple of ways. First, keep in mind that if you want to easily get the questions and their responses currently, you would need to use the Microsoft Forms connector, and the Get response details action. From there, you would need to specify EXACTLY which form to get the responses from…. meaning any kind of notification would need one flow per survey… not ideal.

Let’s look at a different approach using the JSON from the new details field. Our first step is the same as above, the trigger from the Common Data Service current connector, using the condition of Create for the Customer Voice survey responses entity. We then add in a get record step for Customer Voice surveys, using the Survey value from the trigger. This will get us the related survey so we can include this in the email notification at the end. Nothing more exciting than that! Then use an initialise variable action and create one with the type of array. This will be used later so that we can populate it with each Question Text and then the related Answer for the Survey Response.

Now we add a Parse JSON step. The Content needs the Details of the Survey Response value, and the Schema required can be found below. Just copy it, then paste it into the Schema field. Simple.

{
    "type": "array",
    "items": {
        "type": "object",
        "properties": {
            "questionId": {
                "type": "string"
            },
            "response": {
                "type": "string"
            }
        },
        "required": [
            "questionId",
            "response"
        ]
    }
}

Our next step will allow us to find the related question so we can get the text. As we’ve seen, the details provided in the JSON include the question ID and the response provided by the person submitting the survey. It doesn’t give us the text of the question. So, add in a List records step from the Common Data Service connector. Select the entity of Customer Voice survey questions. In the Filter Query, we need to pull back only those questions where the msfp_sourcequestionidentifier is equal to the one with the same questionid as found in the Parse JSON step. We also need to define the query by adding in the mspf_sourcesurveyidentifier. If we have copied a survey, this will create two unique survey id’s, but for copied questions, they will have the same ID. So, adding in both of these makes sure we get the unique question needed. As soon as the filter query is added, the Apply to each will be added to your flow, no need to hunt for it to add manually!

msfp_sourcequestionidentifier eq '@{items('Apply_to_each')['questionId']}' and msfp_sourcesurveyidentifier eq '@{triggerOutputs()?['body/msfp_sourcesurveyidentifier']}'

The next step is an append to array variable action. Select the variable you created at the beginning, and then add in your curly brackets. Between those, add a name for your column header in quotes, followed by a colon, then the value you need to add. Separate the lines by a comma. So you will end up with something like this.

{
  "Question": @{items('Apply_to_each_2')?['msfp_questiontext']},
  "Response": @{items('Apply_to_each')['response']}
}

Next, we will use the Create HTML table action, using the variable we populated. Important to note, this must sit OUTSIDE of the Apply to each steps above so it runs after all of your questions and responses have been added to the array. The Compose step underneath is used to add a bit of styling to the table to make it look nice. Check out this post from my good friend Ryan Maclean for how to do this. It’s really simple yet so effective!

The final step is to create your email or whatever notification you have for your own requirements. This one is simple and just shows the name of the survey and then the outputs from the Compose step that formatted the table.

Next time a survey response is received, an email will be generated, including all of the questions and the answers provided. You could of course use the Get record step many times to get more details about the person who provided the response as required. You could also create a task, post a notification in Microsoft Teams, or share details of this information using Customer Insight cards.

One final thing to note, you could also use Power Automate to check for an individual specific question when it is answered. To do this, add a condition step to check and see if the questionid is equal to a specific id, then if Yes, carry on and add in the rest of your actions.

You can also watch the video on how to do this here.


Check out the latest post:
Mask And Unmask Content In Microsoft Clarity


DISCLOSURE: THIS POST MAY CONTAIN AFFILIATE LINKS. FULL DETAILS HERE
This is just 1 of 271 articles. You can browse through all of them by going to the main blog page, or navigate through different categories to find more content you are interested in. You can also subscribe and get new blog posts emailed to you directly.


4 thoughts on “Sending Notifications From The Details Of Survey Responses

  1. I spent about 20 hours working on this myself a couple weeks ago and finally gave up and instead just embedded the subgrid of the responses into my custom entity, which worked for my purposes, but I’m going to give this a try today as it would be much better. Thanks!

    1. Oh perfectly timed then! This was just added on Friday I believe… so it’s VERY new!

  2. Worked well. I don’t typically use the common data service (current environment) because I have flows organized differently and have many environments… but used it for this for testing, since the regular common data service didn’t have the same trigger. Everything worked great though, wish I hadn’t wasted all those hours trying to figure this out myself.

Leave a Reply

Your email address will not be published. Required fields are marked *