D365 CE- Incident management integration with SAP Qualtrics – Part 3

In part 3 of my blog , I am going to explain about how I have use Common Data Connector (CDS) to call qualtrics API’s and update back the response in D365 CE.

Login to power platforms and go to flows

I have achieved my scenario using 2 power automate flows in CDS

a) Automated Flow : When a Qualtrics transaction record created in D365 CE on close of an incident

b) Scheduled Flow : To get the survey link after the import is successful and update back the Survey Link.

First Automated Flow “Qualtrics – Create Transaction and Contact”

  • Connect to your environment, Select entity and define scope
  • I have used HTTP connector to call API, and used the URL stored in transaction recorded created in D365 CE from the Async plugin. For the detailed API and body structure, you can refer to part 1 of this blog
  • Initialized 3 variables : Transaction batch status = HTTP response status code, Transaction Id and contact import status URL

  • Check if the API is successful or not . If yes then proceed else update back the record with the exception message
  • I have used Parse JSON to parse the response we get form the previous API call.
  • Stored Transaction batch ID and make another API call for contact import.
  • Once you called the API, capture the response status to check if it is failed or successfull
  • Proceed further if it successful else update back the record with the failed message.
  • Again parse the response body to get survey link
  • Update survey link field in Qualtrics transaction record in D365 CE

Second Flow : Scheduled for every 5 minutes – Get Survey Link form Qualtrics

  • Get list of the records whose contact import status is In Progress and transaction Id is filled based on previous API call.
  • Initialize couple of variables : a) Survey link – to store the link URL b) distribution Id – To store distribution Id
  • Loop through each record and call distribution link API
  • Parse the response using Parse JSON
  • Set Distribution Id Variable
  • Call our last API to get the generated link using distribution ID
  • Again parse the response using JSON Parse
  • Start updating record with survey link and distribution ID

Hope you have enjoyed my blog.

D365 CE- Incident management integration with SAP Qualtrics – Part 2

Recap to the previous blog:

  • Created transaction batch
  • Linked transaction batch to the customer along with the transaction data
  • Checked Import Status if its not completed

Step 4 : Generate distribution link for the transaction Batch

Post : https://fra1.qualtrics.com/API/v3/distributions

Body :{        
“transactionBatchId”: “{transactionID}”,  “surveyId”: “{surveyId}”,  “linkType”: “Individual”,  “description”: “test distribution List”, “action”: “CreateTransactionBatchDistribution”              
}

Capture distribution Link Id form the response, this will be used to get the actual link

Step 5 : Retrieve Generated distribution link, which will have actual survey link

GET: https://fra1.qualtrics.com/API/v3/distributions/{distributionID}/links?surveyId=sureveyID

Get the link and embed it into the email sent to the customer.

So far so good, we have validate all the API’s required to get survey link from qualtrics.

What should be the end to end design ?

Based on my experience and the amount of cases/incidents getting closed per day (i.e.600). I have decided to have a Qualtrics transaction record entity which will get created by an Asynchronous plugin registered on close message of incident. Which will have all the details required to perform 5 Api’s call as explained earlier. Once done a workflow will be triggered after the survey link update in the record which will send the email to the customer.

I have also used configuration entity in CRM to store directory id, survey Id , mailing list Id, APi’s URL structure

Plugin Details: This async plugins creates a related case record and gather all the necessary information needed to make API call. This plugin also fetches information from configuration record.

When you resolve a case , check the related record created

On Create of transaction record in CRM I have create a triggered Flow in Common Data Service which gets triggered and Call Quatrics API’s mentioned in step 1 to 3 on my previous blog. SO when you open the record you will have Qualtrics Transaction Batch ID, survey ID, and tracking URL for the import status

To achieve step 4 and 5 mentioned, I have a scheduled CDS connector which runs every 5 minute and fetch only those transaction records whose import status is in progress. Check if it is completed 100% and then make HTTP call remaining API’s. Get the survey link and update backs Qualtrics Survey link record. On update of that field I have a workflow registered which will send email to the customer along with the survey link and set the regarding as case entity.

Now Lets check if the email is generated with the link that we want to achieve

Next lets check how it looks like in Qulatrics after submitting the response

This is the end to end journey. Their is one thing that I haven’t explain in details about how I used CDS connectors to make HTTP call and update back CR record. I will be explaining those in my next blog

Go to my Previous Blog : https://rahultiwarydynamiccrmblogs.wordpress.com/2020/08/04/d365-ce-incident-management-integration-with-sap-qualtrics-part-1/

D365 CE- Incident management integration with SAP Qualtrics – Part 1

In my current project, I had a requirement to integrate Microsoft’s Customer Service module with SAP’s Qualtrics survey management system in real time.

Detailed Requirement: When a service agent resolves an incident in D365 CRM a survey link should be sent to the customer via email for CSAT (customer satisfaction) which will get captured in Qualtrics and reporting will be done accordingly.

Responsibilities of each System :
a) D365 CRM – Send customer information along with the case details to Qualtrics.
Capture survey link from the Qualtrics response and embeds in email and send it to the customer.
b) Qualtrics – Identifies the customer, if it’s new just create it else update and give us a survey link specific to that case/incident and customer. Once customer fills that information, capture the response and link it back to specific case number, customer and the agent who resolved this.

How we achieved this ?

Qualtrics :

Need a token to authenticate, mailing list, directories, survey and all the API’s that will help to achieve this
Login to qualtrics and go to account settings -> Qualtrics IDs

Get your Directory ID , Survey ID, Mailing List Id and Token to authenticate

Now we have all the prerequisite to start working with the Qualtrics API’s. https://api.qualtrics.com/api-reference/
Let’s open postman and start validating API’s that we require to achieve this functionality

Header will be common to all the API calls
Key : X-API-TOKEN and Value : Token
Key : Content-Type and Value : application/json

Body : {  “transactionIds”: []
}
Store the transaction ID that you will get as a response

  • Step 2 : Call Contact Import transaction API : This is basically to attach contact details with the transaction along with transaction data if any. Now in our case want to pass case number and agent name who resolved the case.

    POST : https://fra1.qualtrics.com/API/v3/directories/{directoryId}/mailinglists/{mailingListId}/transactioncontacts

Body :{  
“transactionMeta”: {    
“batchId”: “transactionId from the previous API response“,    
“fields”: [      “CaseNumber”,    “AgentName”    ]  },  
“contacts”: [{ 
     “firstName”: “Rahul”,  “lastName”: “Tiwary”, “email”: “rtiwary@microsoft.com”,  
“extRef”: “rtiwary@microsoft.com”,      “unsubscribed”: false,
 “transactionData”: {        “CaseNumber”: “CAS-99999-C1H0W3”,   “AgentName”: “Harsh Tiwary” }   
 } ]
}

In response you will get import Id , tracking URL and status. Initially the status will be In-Progress and we can’t go to the next step till the import status is not completed. Now how to check the status ? Using tracking URL. So it its best idea to store this tracking URL and check the status accordingly.

  • Step 3: Tracking Import Contact Status
    You can call the same Tracking URL that you get in response to import contact. Below is the format of the same

Get: https://fra1.qualtrics.com/API/v3/directories/{directoryId}/mailinglists/{mailingListId}/transactioncontacts/{importContactStatusID}