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.
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.
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!
Capture the SurveyID (msfp_sourcesurveyidentifier) and ProjectID (_msfp_project_value)
Extract the values from your list rows action using first() compose actions as below
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: