I’ve written about using survey variables in Forms Pro to create a personalised experience for your clients. You can use variables in email templates, in the survey questions and sub-titles, and when embedding within a website. We can also use variables as hidden values, used specifically as a way to link surveys and their responses together. Consider a case closure feedback survey that you have several copies of, one for each of your products or brands. If the questions are all the same, why would you want a different report overview for each? Let’s look at how a simple variable can help us gather the responses together.
First, add a survey variable to each of your surveys that you want to link. For this example, the variable is called Survey Group. You can add the code or name you want to use for the link into the default field. However, we can change this for each survey as needed. For this example, there are three surveys to link together (based on a presentation I did with the theme of Super Heros).
Next, you need your first Power Automate flow. When your trigger occurs the flow needs to run. The important step in the flow is when you create your invitation or send the survey. You will have the Survey Group variable to populate. If left blank it will use the default added in the Forms Pro survey. Type in the value you want to use as your link. Make sure that any other flows you have that may run to trigger this survey have the exact same Survey Group value. Also, make sure you have the same Survey Group value in any flows for surveys you want to link together.
Next, we need to set up our flow to run when a Survey Response is received. For that, we need to fill out the survey one time so we can populate the Context Data field on the response. If you don’t have direct access to CDS in a model-driven Power App, take a look here to see how to get the Context Data you need. If you do have access, go and look at the response received, and copy the contents of the Context Data field.
This post will show the typical steps you might need when a survey response is received, but it’s the Parse JSON step that will provide the ability to extract the Survey Group variable we passed through in the original invitation. Add the step, and use the Context Data value for the Content. Click on the ‘Generate from sample’ button at the bottom of the action. Then, paste the Context Data you copied earlier.
After the Parse JSON step above, we can now add an Update record step and update the Survey Response that was originally created (from the trigger of the flow). This record is different from others, in that it is locked. We can’t add new fields to it, but we can update the form. The record is an activity, which means it has a field called ‘Activity Additional Parameters’. This is a text field not used by the Survey Response entity, so let’s use it! Populate the field with the Survey Group variable from the Parse JSON step in your flow.
Here we can see that Activity Additional Parameters field gets populated with our Survey Group value from the Forms Pro survey.
We can now use this in a variety of ways to combine our Survey Responses. If using CDS (or D365CE), we can create an advanced find and search on the Activity Additional Parameters field.
We can also use it in a Power BI report to get an overview of all responses linked within the same Survey Group, creating columns and measures to give us the overall Net Promoter Score for ALL of those responses, rather than just survey by survey.