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?
- A D365 Instance with Exchange Sync enabled
- Cognitive Services Translator Text API and Text Analytics API
- Create two subscriptions in Azure for the Cognitive Services Translator Text and Text Analytics APIs and get the API Keys.
- Apply the API Keys in the D365 instance.
- 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
- Navigate to the Azure Portal and create two API services for the below services
- “Translator Text API”
- “Text Analytics API”
- Copy the API keys from each service that was created in the above step.
Apply the API Keys in the D365 instance.
- Navigate to “Processes” in the Setting area and open the process with the name “EmailTextAnalytics.Workflow”
- Deactivate the process and update the “EmailTextAnalytics.Workflow (18.104.22.168):MicrosoftLabs.EmailTextAnalytics.Workflow.EmailTextAnalytics” step with the API Keys retrieved before.
- 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
- Navigate to Form editor on the Out of the box Email Form and add a new Web resource by the name “msdyn_SentimentEmotions”
- Add the “msdyn_sentiment” field to the from Email form as well .
- Add the “msdyn_translatedemailbody” field to the from Email form as well .
- Once the above steps are complete the form should look like below.
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.
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.