Dynamic inputs for Project and Survey IDs in Customer Voice Survey actions in Power Automate

In case you missed it - you can populate variables and send surveys through Customer Voice using Power Automate. There is heaps of content out there on Customer Voice, I’ve done a few pieces before, and Megan V Walker as a juicy archive too.

One thing I always struggled with was moving flows between environments that use customer voice actions ‘Create an invitation’ or ‘Send a survey’ because the action is tied to specific Project and Survey. I worked out a lovely little method to do this without having to use environment variables or post deployment changes. Whilst also being able to populate survey variables in the box called ‘The fields to send to Web Merge’. I suspect there are many ways to achieve this but I guess this is my way that I thought someone else may want to use, including future me.

Two assumptions here, this solution is not bullet proof but not much about this survey ALM story is so I’ll take the hit because it beats post deployment updates to flows.

  1. When you create your survey(s), you copy them to /from your target environment whilst preserving the name but maybe add in something like "‘COPY’ or ‘TEST’ to the name. You could also just not rename them at all but this has cause me issues in the past.

  2. You do not have multiple surveys with the same name

Renaming between environments is optional, but if you completely change the name of the survey, or have multiple surveys with the same name then this method is not for you!

Find the Survey using the Survey Name

The key here is that we are using contains() rather than eq (equals) because this allows us to modify the survey name between environments without breaking the flow logic. This single action captures both values you need in one hit.

e.g. Production survey name: 3.0 SCORE Client Satisfaction Assessment, Sadndbos survey name : SANDBOX 3.0 SCORE Client Satisfaction Assessment

FindSurveyID - List Rows Dataverse
Table name: Customer Voice surveys
Select columns: msfp_sourcesurveyidentifier,_msfp_project_value
Filter rows: contains(msfp_name, 'Your survey name part that doesn’t change')

Capture the SurveyID (msfp_sourcesurveyidentifier) and ProjectID (_msfp_project_value)

Extract the values from your list rows action using first() compose actions as below

ProjectID
Inputs: @{first(outputs('FindSurveyID')?['body/value'])?['_msfp_project_value']}

SurveyID
Inputs: @{first(outputs('FindSurveyID')?['body/value'])?['msfp_sourcesurveyidentifier']}

Send the Survey with Populated Survey Variables

Add a ‘Create an invitation’ or ‘Send a survey’ action, set the Project inputs with your ProjectID and the Survey input with SurveyID. As soon as you turn the Survey & Project inputs into dynamic values, the personalisation variables change from lovely named inputs into a single box called ‘The fields to send to Web Merge’. Don’t panic, you can still set the variables you just ned to format them yourself into JSON like the example below. Makes sure you break each line with a comma (,) except the last one and wrap the inputs in curly brackets {}.

Create an invitation or Send a survey - Dynamics 365 Customer Voice
Project: @{outputs('ProjectID')}
Survey: @{outputs('SurveyID')}
The fields to send to WebMerge:

{
“VariableNameInCustomerVoice1“:”Value of variable”,
“VariableNameInCustomerVoice2“:”Value of variable”,
“VariableNameInCustomerVoice3“:”Value of variable”
}
Previous
Previous

Create Form Submission and Event Registration Summaries in Dynamics 365 Marketing

Next
Next

Export Marketing Form Submissions in Dynamics 365 Marketing