App Source, Azure, Cognitive Services, Customisation, Dynamics 365, Dynamics CRM, Microsoft Labs

Language translation and Sentiment Score Analysis for CRM email using Azure Cognitive Services.

Introduction

Last week I wrote and article on how we can get the Text Sentiment using Azure Cognitive Services via LogiApps. Today what we are going to look at something similar.  I came across an solution on AppSource, built by Microsoft Labs that can translate language and provide the text sentiment for Email records in CRM using the Cognitive Services. In this solution unlike the one I explained in my previous article, we dont need to use LogicApps as the integrating platform.In this example Microsoft Labs has developed a custom workflow component to pass the information to the Azure Cognitive Service.

So, lets have a look on how we can get this solution installed and configured.

What do we need?

  1. A D365 Instance with Exchange Sync enabled
  2. Cognitive Services Translator Text API and Text Analytics API

Steps

  1. Create two subscriptions in Azure for the Cognitive Services Translator Text and Text Analytics APIs and get the API Keys.
  2. Apply the API Keys in the D365 instance.
  3. Configure the D365 Out of the Box Email form to add the web resource which will display the emotions as a smiley face based on the text sentiment and the text box to display the translated text.

Creating subscriptions for the Cognitive Services

  1. Navigate to the Azure Portal and create two API services for the below services
  • “Translator Text API”
  • “Text Analytics API”
  1. Copy the API keys from each service that was created in the above step.

Apply the API Keys in the D365 instance.

  1. Navigate to “Processes” in the Setting area and open the process with the name  “EmailTextAnalytics.Workflow
  2. Deactivate the process and update the “EmailTextAnalytics.Workflow (1.0.0.0):MicrosoftLabs.EmailTextAnalytics.Workflow.EmailTextAnalytics” step with the API Keys retrieved before.                                                                                                                       
  3. Copy the Key from the Translator Text API to the “TranslatorAccessKey” parameter and the key copied from Text Analytics API to the “AzureAccessKey” parameter. Save the changes and Reactivate the workflow.

Configure the D365 Out of the Box Email form

  1. Navigate to Form editor on the Out of the box Email Form and add a new Web resource by the name “msdyn_SentimentEmotions
  2. Add the “msdyn_sentiment” field to the from Email form as well .
  3. Add the “msdyn_translatedemailbody” field to the from Email form as well .
  4. Once the above steps are complete the form should look like below.

Testing

I have created an email record with some text in French. You can see as per the below screenshot the Text has been converted to English and Sentiment score has been updated as well.

Conclusion

Considering it’s a free solution by Microsoft Labs, it provides a good starting point for those who want to get into Cognitive services integration with D365. Although the solution is free , there will be a cost involved with Azure Cognitive Services .

Provided this only works with Email records this solution has potential in expanding to other System as well as Custom activity types.

I Hope this article will help you in your day to day consulting work . If there are any questions please feel free to email or comment.

Tagged , ,

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.