Dynamics 365 Forms Pro

Customer survey sent after purchase part 3/3: Configure a flow

Task: Automatically send customer survey after an opportunity is won
Difficulty: Medium
Time to implement: 1-2 hours


  1. Creating the survey
  2. Configuring the email template
  3. Configure a flow

In this article we will conclude this blog series by configuring a flow for our survey in Power Automate.

Creating a flow

In our previous post, I created a survey email template for Power Automate. In the same editor we:

  1. Click on the ‘Configure a Flow’ button. We are then presented with options to create a flow from a template or start from scratch.
Configure a Flow button
  1. Select ‘+ Create from blank’. This will open the flow builder inside of Forms Pro.

Configuring the flow

The flow that we need to build contains a few relatively simple steps. First, we need to define a so-called trigger. This is our opportunity record in Dynamics. Secondly, we must define a condition for sending out a survey, i.e. our opportunity being closed as won. In the latter case I feel that Dynamics 365 workflows are better because in a workflow you can see which options are available within an option set field (i.e. the label). In Power Automate, on the other hand, you can’t. The workaround is to find the numeric value of ‘Won’ in the option set (no very intuitive, I know). I’ve done this for you, so you don’t have to worry about it (however, I always encourage users to make tests before deploying).

A) Check when an opportunity is updated

  1. For the first block we will search for ‘When a record is updated’ and choose a trigger from Common Data Service (CDS).
  2. Choose the appropriate environment in the first drop down list.
  3. Choose ‘Opportunities’ in the second drop down list.
  4. Make sure the Scope is set to ‘Organization’.
When a record is updated in CDS

B) Insert a Condition step

  1. Click ‘+ New step’ below the blog. Now we have the trigger defined we must check whether the opportunity is won or not.
  2. Define the first field as ‘Status Reason Value’ via the Dynamic content.
  3. In the conditional statement choose ‘is equal to’.
  4. In the value field put ‘3’. This is the numerical value behind the ‘Won’ status reason.
Condition definition

C) Get contact information

When we are working with an opportunity we must consider who is the survey respondent. Also, when will the survey be sent out. When I implemented this for a car dealer the survey was sent to a contact immediately after the opportunity was closed as won. The reason for this is that the salesperson waited for a few days before actually closing the opportunity. First the vehicle had to be delivered to the new owner and the salesperson phoning the buyer to see if everything was satisfactory. In this hypothetical case we assume that the sales team is working according to the a similar process. We will therefore retrieve the contact information and send the survey immediately after the opportunity has been closed as won. To get the contact info we:

  1. Click ‘+Add action’ inside the left-hand box labeled ‘If yes’ (this is the route our flow follows if the condition in B) is true).
  2. Search for ‘Get record’. This is again a CDS connector.
  3. Define which record type we want and from which environment.
  4. In the Item identifier field we select Contact from the corresponding field in our opportunity trigger that we defined in A). We can find this field again by using Dynamic content.
Get contact info

D) Send the survey

Now we have the contact information at our disposal. This gives us the chance to leverage information pertaining to the contact, such as his name, email address, etc. Forms Pro offers many out of the box variables which are part of its connector. This allows us to store information about the associated record in Dynamics as well as the contact information with each response we get from our respondents. With this data we can track which opportunities were successful and which ones were not. This can be quite valuable when it comes to service management and continuous improvement within the organization. To send the survey we:

  1. Click the ‘+ Add action’ button below the Get record action we created in our previous step. There are many options here so bear with me.
  2. In the To field insert the contact’s email. You can find this field in the Dynamic content.
  3. In the Survey field select the survey we created in my first blog post. In this case it is called ‘Thank you for your purchase’.
  4. In the Email template, insert the template we created in my second blog post. In this case I have called it ‘How do you like Alpha Protect?’.
  5. In the Regarding field, select the ‘Opportunity ID’ value of the opportunity record. This is important as we would like to know which record to associate the response.
  6. Complete the rest of the fields, Recipient details, First and Last names using the ‘Contact’ field from the opportunity, first and last names of the contact, respectively.
Send a survey

Testing the flow

As always, we need to test our flow. To test the flow we:

  1. Click ‘Test’ on the top right corner of the flow builder.
  2. Choose ‘I’ll perform the trigger action’.
  3. Click Test.
  4. Go to our Dynamics 365 Sales and close an opportunity as won (if you haven’t created a dummy record before step 3, I suggest you do that and then redo steps 1-3).
  5. If the flow ran successfully you should see plenty of green check boxes on the steps you have defined in the preceding steps.
Test ran successfully

You can also watch how this is done by checking out the video below:

By Stirna Consulting

Stirna Consulting is an IT consultancy, specializing in Dynamics 365 Customer Engagement applications and Power Platform. On our website, you can find tips and tricks about how to leverage these applications for your business.

Leave a Reply