Sonoma Partners Microsoft CRM and Salesforce Blog

Dynamics 365 & Flow – 3 Simple Steps to Email Sentiment Tracking

If you’re not familiar with Microsoft Flow yet, it is definitely worth checking out.  It allows you to easily connect many different applications, one of which is Dynamics 365, to each other.  Earlier this year, the ability to connect to Microsoft’s Text Analysis API was added which takes in a string of text and returns a sentiment score from 0 to 1 with 0 being negative and 1 being positive.  This means we can painlessly connect Dynamics 365 to the Text Analysis API which I will walk through in this post in the form of Email sentiment tracking.

The first thing we need to do is create a custom decimal attribute on the Email entity to track sentiment.

image

Once that attribute is created, navigate to Microsoft Flow and create a new blank Flow.  In the “search for more triggers” box, type “create a record” and choose the Dynamics 365 option.  You will need to authenticate to your Dynamics 365 environment and then select your Organization Name from the list.  Once that is done, select Email Messages from the Entity list as well.

image

Next, click “+ New step” and select “Add an action” and in the “Search for more actions” box, type “sentiment” and select the “Cognitive Services Text Analytics” option.  You will then need to sign up for Cognitive Services and provide your API Key to Flow.  It is free to try for up to 5,000 API calls per month.

Once you provided your Cognitive Services details, put your mouse cursor in the “Text to analyze” box and a sidebar should show up with a list of options like so:

image

Find “Description” in the list and select it.

Next, click “+ New step” and “Add an action” again.  Search for “update a record” and choose the Dynamics 365 option.  Again select your Organization and Email Messages.  Highlight the “Record identifier” box and choose Email Message from the sidebar list of options.

image

Then click the “Show advanced options” at the bottom of the Update a record section.  This will expand the section with a big list of Email attributes.  You should be able to find the custom Sentiment attribute that we created in the beginning of this post. 

Highlight the Sentiment text box and select Score from the sidebar list of options.

image

That’s it!  The Flow is complete so you can give it a name at the top of the page and then click “Create flow”.

In the list of Flows, make sure the toggle control is set to On.

image

Now in your Dynamics 365 environment, create a new Email record and save it.

Back in Flow, click the circle icon with an ‘i’ in the middle.

image

This will show a history of runs for the Flow.

image

Once you see that your Flow was successfully ran, go back to your Email record in Dynamics 365 and you should see the Sentiment field populated.

image

Now all emails created in Dynamics 365 will have a sentiment value populated.  You could even extend it further and add a native Rollup field to Contact to store the average Sentiment across all emails that were sent by the Contact.

There is a caveat that the Text Analysis API is only free for 5,000 calls per month.  Below is the pricing chart taken from the Cognitive Services pricing page:

image

Topics: Microsoft Dynamics 365 Microsoft Dynamics CRM Online