Top Posts
ClickDimensions – Middle Ware
PowerPlatform / Dataverse – Five Layers of Security
Solution Framework Fundamentals
Solution Strategy
FLOW – The Workflow Replacement
Power Automate: Your UI testing companion – Part...
Updates Delayed
Build the Future
Learn more about me…
Power Automate Patterns: Scottish Summit 2020
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 November 2020
by Dave Burrell 13th November 2020
0FacebookTwitterLinkedinRedditWhatsappEmail
695

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.

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.

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.

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.

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.

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.

Step 5 – Send Survey

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

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.

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.

Step 1 – When a record is created

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

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.

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.

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.

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.

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.

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.

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.

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.

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
Solution Framework Fundamentals
next post
Power Automate: Your UI testing companion – Part 1

You may also like

PowerPlatform / Dataverse – Five Layers of Security

18th May 2021

Power Automate: Your UI testing companion – Part...

11th December 2020

Power Automate: Your UI testing companion – Part...

11th December 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

  • Power Automate: Protect your Flow Run History 28th September 2021
  • Building the Future: Power Platform for Girl Guiding 22nd September 2021
  • Build the Future 18th August 2021
  • Power Platform Community – Resources! 12th August 2021
  • PowerFX – A Game Changer! 18th July 2021
  • Facebook
  • Twitter
  • Instagram
  • Linkedin
  • Youtube
  • Email

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


Back To Top
Dave Burrell
  • Home
  • Power Automate
  • Power Platform
  • D365
  • Solution Architecture
  • Lifestyle
  • About Me
  • Contact Me
We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok