Dave Burrell
  • Home
  • Power Automate
  • Power Platform
  • D365
  • Solution Architecture
  • Lifestyle
  • About Me
  • Contact Me
Top Posts
Solution Framework Fundamentals
Working from home – How to survive!
Power Automate Patterns: Scottish Summit 2020
PowerObjects: One Year Aniversary!
Dynamics365 / CDS – Five Layers of Security
Solution Strategy
Integration Demystified
#COMMUNITYROCKS – Virtual Lunch
PSA is Dead – Long Live Project Operations
FLOW – The Workflow Replacement
Dave Burrell
  • Home
  • Power Automate
  • Power Platform
  • D365
  • Solution Architecture
  • Lifestyle
  • About Me
  • Contact Me
Dynamics 365Power Automate

Power Automate: Send a Case Closure Survey

by Dave Burrell 13th February 2020
by Dave Burrell 13th February 2020
0
FacebookTwitterLinkedinRedditWhatsappEmail

I was helping a member of the Power Platform community resolve an issue they were having, and I have been able to resolve the requirement with the following solution.

The Requirement

When a case is resolved within Dynamics 365, a Forms Pro survey should be sent to the customer to allow them to provide feedback. When the response is received, the feedback should be logged against the case.

Solution Overview

To deliver a solution to the requirement, I have created two Power Automate flows. One of which sends the initial survey to the customer and a second to tie the response back to the original case.

In addition to this, I also created a custom variable on the Forms Pro survey that can be used to find the original case when the response is received.

Forms Pro Setup

You set up the survey within Forms Pro as you would any other survey the only change that was made here was to create a variable for CaseID.

Power Automate: Send a Case Closure Survey PACaseSurvey1

Flow 1 – Send Survey on Case Closure

The next piece of the puzzle was to create a Flow that sends out a survey to the customer when their case is marked as resolved.

Power Automate: Send a Case Closure Survey PACaseSurvey2

Step 1 – When a Record is Created

The first step in the Flow is the trigger action which executes when a record is updated in the CDS. In this case the update of the Case record.

Power Automate: Send a Case Closure Survey PACaseSurvey3

Under the advanced options, an additional attribute filter is added so that the trigger only considers updates to the statuscode filed on the case entity.

Step 2 – Check Condition

The next step is to check if the statuscode has been updated to resolved in this case, value 5.

Power Automate: Send a Case Closure Survey PACaseSurvey4

Step 3 – Check Condition

The next section of the Flow follows the yes branch of the previous condition. There is no need for anything in the no condition. I have created a second check condition to check if the customer against the case is an account or contact. The only reason this was required as the method of getting the email address to send the survey to is different depending on the customer type on the case.

Power Automate: Send a Case Closure Survey PACaseSurvey5

The following steps are duplicated in both the Yes and No branches. The only difference is that in the Yes branch it queries the account for the email address and in the No branch it queries the contact.

Step 4 – Get Record

The next step is to get the customer record to give you access to the email address in the next step.

Power Automate: Send a Case Closure Survey PACaseSurvey6

Step 5 – Send Survey

This step is where the survey is sent to the customer’s email address.

Power Automate: Send a Case Closure Survey PACaseSurvey7 2

In this step, you select the Survey and Email template that you created in Forms Pro.

As you can see the new variable that you also create is available to be populated.

Power Automate: Send a Case Closure Survey PACaseSurvey8

I have chosen to populate this with the case number as I am also using it in my survey template. If you do not require to use this, you could use the GUID here.

Download

Flow 2 – Associate the Response with the Case

The other Flow triggers on the creation of a Forms Pro Survey response and creates a note against the case that the survey was sent from.

Power Automate: Send a Case Closure Survey PACaseSurvey9

Step 1 – When a record is created

The trigger action is upon the creation of a Forms Pro Survey Response.

Power Automate: Send a Case Closure Survey PACaseSurvey10

Step 2 and 3 – Initialise Variables

We now need to initialise two variables that we can utilise further down in the Flow. The first one is the ResponseID this is the identifier of the specific survey response.

The second is a variable to store the Originating CaseIdentifier.

Power Automate: Send a Case Closure Survey PACaseSurvey11

Step 4 – Set Variable

The first variable that we have to set in the Flow is the Response ID; this will be used later to get the full response details.

Power Automate: Send a Case Closure Survey PACaseSurvey12

This is set using the following expression:

@{triggerOutputs()?['body/msfp_sourceresponseidentifier']}

Step 5 – Parse Response JSON

We need to parse the response that we get from the survey to split the JSON up into component parts. We use the Parse JSON function to achieve this.

Power Automate: Send a Case Closure Survey PACaseSurvey13

From the Forms Pro Survey Response, we need to parse the msfp_embedcontextparameters attribute. We can access this using the following expression:

@{triggerOutputs()?['body/msfp_embedcontextparameters']}

Step 6 – List Record

To create a note against the correct case, we need to find the case with the correct Case ID that has been passed over from the Form Pro Survey Response. This will be now available from the parsed JSON we created in the previous step.

Power Automate: Send a Case Closure Survey PACaseSurvey14

In order to return only the relevant case, we can use the following filter query:

ticketnumber eq '@{body('Parse_JSON')?['PipeData']?['CaseID']}'

Step 6 – Apply to Each

As we have used the list records function, it is necessary to use an apply to each as the list records function has the possibility of returning multiple results.

Power Automate: Send a Case Closure Survey PACaseSurvey15

Step 6A – Get Response Details

In order to get the full response details, including the questions and answers from the survey, we have to retrieve the full response using the Get response details function.

Power Automate: Send a Case Closure Survey PACaseSurvey16

We have to set the specific survey that we wish to query and pass in the response ID. As we set this as a variable, we have access to it within the dynamics content.

Step 6B – Set Variable

We now need to set our second variable, which is the CaseID; this will allow us to append the note to the correct case record.

Power Automate: Send a Case Closure Survey PACaseSurvey17

We can get the incidentid which is the unique reference for the case using the following expression:

@{items('Apply_to_each')?['incidentid']}

Step 6C – Create Record

Now that we have all the information that we require, we can go ahead and create a note. In this example, I have chosen to use the note entity, but you could create a custom entity to store this if you prefer.

Power Automate: Send a Case Closure Survey PACaseSurvey18

We can, at this point, select what information we wish to populate from the response into the description. You can access this from the dynamic content.

The regarding field also has to be populated, and we have used the variable that we set in step 6B.

Download Flows

Flow1-SendSurveyonCaseResolution_20200213212412Download
Flow2-AppendSurveyResponsetoNotes_20200213212333Download
Dynamics 365Power Automatesurvey
0
FacebookTwitterLinkedinRedditWhatsappEmail

Leave a Comment Cancel Reply

Save my name, email, and website in this browser for the next time I comment.

Dave Burrell

Hey! I am Dave Burrell a Power Platform Solution Architect. I am an evangelist for all things Power Platform and love nothing more than a #LowCodeNoCode implementation.

previous post
Power Automate – April 2020 Release – Overview
next post
Scottish Summit 2020 – Are you attending?

You may also like

Lack of updates and something exciting….

10th April 2020

Updates Delayed

24th March 2020

Dynamics365 / CDS – Five Layers of Security

9th March 2020

About Me

About Me

Power Platform Evangelist

Hey! I am Dave Burrell a Power Platform Solution Architect. I am an evangelist for all things Power Platform and love nothing more than a #LowCodeNoCode implementation.

Lets be Social!

Facebook Twitter Instagram Linkedin Youtube Email

Quote

Revolutions begin with Community!

Recent Posts

  • Lack of updates and something exciting…. 10th April 2020
  • Updates Delayed 24th March 2020
  • #COMMUNITYROCKS – Virtual Lunch 17th March 2020
  • Working from home – How to survive! 16th March 2020
  • PowerObjects: One Year Aniversary! 13th March 2020

Microsoft Community Posts

  • Sending a Reminder Email from a SharePoint List

    Learn how to send reminder emails based on a date in a SharePoint list.

  • Flow with "When an item is created or modified" triggers old events

    When you create a flow with SharePoint trigger like "When an item is created or modified", you want […]

  • Share Multiple Attachments of SharePoint List via Email using Power Automate

    Share Multiple Attachments via Email in few steps using Power Automate

  • Comparing the members of a distribution list to the members of an Office 365 group or Team

    Analyze the members of a distribution list which is populated by an HR process and automatically […]

  • Power Automate - Format Phone Number Easy

    Take a phone number like 4031234567 and turn it to (403)-123-4567 with one simple step! 

  • Facebook
  • Twitter
  • Instagram
  • Linkedin
  • Youtube
  • Email

@2020 - All Right Reserved. Designed and Developed by Dave Burrell


Back To Top
This website is using cookies. We use them to give you the best experience. If you continue using our website, we'll assume that you are happy to receive all cookies on this website.OkPrivacy policy