In our previous video, we passed Variable to a question and when the recipient opens Survey he sees his case number with Surevey
- setting our custom variable “CaseNumber” created in part 1st in Subtitle i.e Welcome to Dvmske customer experience survey – Created for {{Casenumber}}
- It should look like below when creator preview the survey or when we send this survey as anonymous though the link
- When the survey is sent to the recipient on case resolution, it Variable will have a case number of the recipient.
In This post, we have a scenario where 3rd party Marketing tool which is fully integrated with CRM has a list of emails where they need to distribute Anonymous surveys but there is 1 condition.
Requirement: The survey recipient example abc@dvmske.com receives an Anonymous survey of 50% discount and while filling up the survey he enters different email 123@dvmske.com
- The requirement is to get Recipient Email ID along which Survey Response question email id.
- So there will be 2 Question response
Question 1: Recipient Email (Hidden Question on survey)
Question 2: Email ID
Step 1: Add a hidden text question to the survey.
- As Per the Requirement, we will have 2 Email question in our form
- 1 of recipient email id that will be hidden, 2nd will be visible email id, that will be filled by Recipient
- As we have also embedded survey on our website, we will add 1 more hidden field “Survey Source”
Step 2: For Testing adding a variable in Question and passing Parameter in the survey URL
- For the testing, we will add Variable Source and Recipient Variable in Source and Recipient Question on Survey
- Then passing both the variable in Survey URL parameter
&ctx={“Recipient“:”abc@dvmske.com”,”Source“:”Email”} - When Recipient submit the Survey we will receive these value with each Response and we can map these Variables with “Survey response questions Responses” in Dynamics 365 crm
In Below example, we are using Source as Email, We can set Source as Website for embedded Survey in our Website
NOTE: THESE 2 FIELDS WILL BE HIDDEN IN ORIGNAL SURVEY
Step 3: Mapping variable to Question Response in Dynamics 365 Once Recipient submits the survey
- Once Recipient Submits the Survey, Power automate trigger will Generate a Question Response on Receive of Survey Response in Dynamics 365, NOTE: THESE QUESTIONS WERE HIDDEN SO QUESTION RESPONSEÂ WILL NOT BE AUTOGENERATED.
1. Create new automated flow
- Create New automated flow
- Select Common Data service and Action as when a record is created
- Fill in Environment and entity
3. Get form pro survey Question "Recipient" and "Source"
- Add new step List Records -> Renaming it Get Recipient Question
- Add new step List Rec-> Rename it Get Source Question
2. Parse JSON using Survey Response context
- Selecting Action as Parse JSON
- Selecting Context Data
- Now we will generate a schema from the sample , Going to an already received Response record in Dynamics 365
- Then copy the context and Generate Schema
Step 4: Create New forms pro Survey Question Response to store Recipient and Source Variable Value
- Now we have our Received survey Response
- Survey Question = Recipient
- Survey Question = Source
- As our question was hidden and there was no answer, there will not be any Recipient and source Survey Question Response
- We will create Recipient and source Question response and associate it with received survey response
- To get Source Question identifier and Question for Recipient and Source(replace name) use below expression, As we have used fetch list of record where Question = recipient, we need to take 1 record only otherwise we have to use Apply to all (loop)
body(‘Get_Recipient_question’)?[‘value’]?[0]?.msfp_sourcequestionidentifier
body(‘Get_Recipient_question’)?[‘value’]?[0]?.msfp_questionid
NOTE: &ctx={“Recipient“:”abc@dvmske.com”,”Source“:”Email”} Values inside these are not static, if there are 50 recipients while sending the survey link its marketing team responsibility to attach parameters.
Testing above scenario -> Recipient ABC@DVMSKE.COM and Email Enter is 123@gmail.com , Source = Email
- Email Sent ABC@DVMSKE.com so Variable Recipient will be = ABC@DVMSKE.COM
- SOURCE = EMAIL