List of all blog posts on CRM and Azure Integration


Configure Product Recommendations using Recommendations API in Dynamics 365

For configuring Product Recommendations first we need to enable the preview –

Go to Settings – Administration – System Settings – Previews

Select Yes and Click on OK.

As a next step, we need to create Cognitive Services for Recommendation API and connect it to CRM.

Go to Portal

https://portal.azure.com

Search and select Cognitive Services Accounts

Click on Add

Select Recommendation API and provide other details and click on Create.

From Overview, note down the Endpoint which will be used to configure the connection in CRM.

From Keys, copy value of the Key which will be used for configuring connection to CRM.

In CRM, go to Settings – Administration and click on Azure Machine Learning Recommendation Service Configuration.

Specify the value for the URL and Key we had noted down earlier, save the record and click on Test Connection to test the connection.

On Successful connection, we’d see Success message for Last Connection Status. Click on Activate to enable the connection.

Now we need to define\build the model for recommendations. For this go to Settings – Product Catalog and click on Product Recommendations.

We’d see a recommendation model with default values

The model will have Basked Data Entities already defined. We can edit\add new\ delete these existing configuration records for Basked Data Entities. Basked Data Entities recommendations are based on which products appear together.

For e.g. in below Opportunity record we can see 27 inch and 12 inch monitor opportunity products appearing together. It will look for all such line items records.

Similarly we have recommendation entities records configured which we can update.

Once done with the configuration, we need to click on Build Model Version to build the model.

It will create a corresponding model version record.

We can check its progress by refreshing it.

Here the model that we had defined has successfully build and it took around 6 minutes.

We can click on the Model Version to open the record to get the further details.

Next step would be to check the recommendations. For this click on Test Recommendations.

Pop up opens wherein we can select the Products and model version and click on Show Result to see what are the product recommendations.

Once satisfied with the test result, click on Activate to enable the recommendations.

We might get the below message in case we do not have good enough data in our system.

To see it in action, open an existing opportunity record , go to product sub grid and select a product and select Suggest Products.

A dialog box opens up that shows the Cross-Sell products and other details.

Get all the details here

https://technet.microsoft.com/library/56b35229-72f8-46ca-bebf-eae023f633c2.aspx

Hope it helps..

Configure Automatically suggest knowledge articles using Cognitive Services Text Analytics (Preview) in Dynamics 365 (online)

As a first step, we need to set up Text Analytics Service and connect it to our CRM Online. Follow the below post for that

https://nishantrana.me/2017/03/24/configure-case-topic-analysis-using-cognitive-services-text-analytics-preview-in-dynamics-365-online/

Next, we need to set up Knowledge Search field settings

For this go to Settings – Service Management and click on Knowledge Search field Settings

There click on New to create a new Search Model record.

Below we have specified case as our source entity. Click on Save.

Next, we need to define Keyword fields for our model, click on + to create a new text analytics entity mapping record.

To keep things simple, we have selected entity as Case and Field as Case Title based on which suggestions will be made. Save the record.

Click on Activate to activate the model.

Next, we need to modify the Case form to include knowledge base suggestions

Open the Conversation Tabs, go to Knowledge Base Search and select Text Analytics for Give Knowledge base suggestions as described below and publish the form

Open any of the case record, go to KB Records. Here based on the Case Title, the text analytics picks up the keyword “Delay” and shows/suggests the corresponding KB Articles matching that keyword.

Get all the details here

https://technet.microsoft.com/en-us/library/mt703319.aspx

Hope it helps..

Configure Document Suggestions using Cognitive Services Text Analytics (Preview) in Dynamics 365 (online)

Let us take a simple example to understand how to configure Document Suggestion preview feature.

To do so first we need to enable Text Analytics Service, Connect it to our CRM Online and configure similar record suggestions. Please follow the below post for all the details.

https://nishantrana.me/2017/03/27/configure-similar-record-suggestion-using-cognitive-services-text-analytics-preview-in-dynamics-365-online/

Go to Settings – Document Management – Manage Document Suggetions

Select the entity for which we want to enable it, as we had our similar record suggestions enabled for Case we select the Case entity here.

Click on Apply.

Now as we already have Similar Record Suggestions configured for Case entity, for a case record with Delay keyword in its title we get the below suggestions

So, for Delay in Dispatch record we are getting Delay in service, delivery and shipment as suggestions as similar cases.

Now what we have done over here next is that we have attached document(s) to each of these case records.

For Delay in Dispatch case record –

For Delay in Service case record –

For Delay in Shipment record we have 2 document attached.

For Dispatch in Delivery case record we do not have any document attached yet.

Now let us open case with title “Dispatch in Delivery” and go to its Documents related records and click on Show Suggestions button

A dialog opens which list all the documents that are associated to the case records similar to the Delay in Delivery record i.e. all the remaining case records having delay keyword in its title.

Select documents and click on Copy.

Documents Copied to the Delay in Delivery record.

Hope it helps..

Configure Similar Record Suggestion using Cognitive Services Text Analytics (Preview) in Dynamics 365 (online)

As a first step, we need to enable text analytics and connect it to CRM.

Follow the below post for enabling text analytics, connecting CRM online to Text Analytics service.

https://nishantrana.me/2017/03/24/configure-case-topic-analysis-using-cognitive-services-text-analytics-preview-in-dynamics-365-online/

As a next step, we need to configure Similar Records Suggestions, for that go to

Settings – Data Management – Similar Records Suggestions settings

Click on New to create a new similarity rule record

Below we have created rule with Case as source entity and specified Yes for “Use Text Analytics for Target Match”

After we have created the similarity rule, we need to define the fields based on which matching will be done and suggestions will be made.

Here we have specified Criteria as Text Match, which would match the Text for the field Case Title of the Case Entity.

Save the above record and click on Activate to run the similarity rule.

Open any of the existing case, in our below scenario we have opened the case with title “Delay in Shipment” and click on +

This opens up the dialog that shows similar cases (with title having Delay word in it) using Text Analytics Service configured.

What happens if we deactivate the Similarity Rule?

We get the below error –

Checking the metric in the Text Analytics API.

Get all the details here

https://technet.microsoft.com/en-us/library/mt703318.aspx

Hope it helps..

Requests to this API should contain at least 100 documents, where each document is not null or empty error while configuring Topic Analysis using Text Analytics in Dynamics 365

Hi,

Recently while trying to configure Topic Analysis in Dynamics 365

https://nishantrana.me/2017/03/24/configure-case-topic-analysis-using-cognitive-services-text-analytics-preview-in-dynamics-365-online/

we got the below error for the failed record.

Error Message:{“code”:”BadRequest”,”message”:”Invalid request”,”innerError”:{“code”:”InvalidRequestContent”,”message”:”Requests to this API should contain at least 100 documents, where each document is not null or empty”,”minimumNumberOfDocuments”:100}}

This was because we had very few case records in our CRM organization < 30. We created few more records to increase the count to be more then 100 and re run the build. This time it got succeeded.

Hope it helps..

Configure Case Topic Analysis using Cognitive Services Text Analytics (Preview) in Dynamics 365 (online)

“Update – The Cognitive Services Text Analytics Topic Detection API required for this feature will be removed as of August 24, which means this feature will no longer work after that date and a topic analysis run will return an error.

https://technet.microsoft.com/en-us/library/mt752501.aspx

Text Analytics Preview feature is currently available for instances in US region. Topic analysis can be used to automatically identify topics that occurs in cases.

To enable the preview, go to System Settings – Preview tab and select Yes for Text Analytics Preview.

Click OK to confirm.

Next go to Administration and click on Azure Machine Learning Text Analytics Service configuration to configure the service.

Here we would need the Azure service URL and the Azure Account Key to configure it.

To do so, go to Azure Portal

https://portal.azure.com

Search for Cognitive Service Accounts

Click on Add and Specify required information.

Select Text Analytics API as API Type.

Click on create to create the service account.

Copy the Endpoint of the created Cognitive service account which will be used as Azure Service URL in CRM.

Similarly select Keys, and copy one of the Key which will be used as Azure Service Key in CRM.

Specify the values in the Text Analytics Connection record.

Click on Test Connection to test the connection.

After successful test, click on Activate to activate the connection.

Next let us create a Topic Model which will be used to identify topics occurring in the cases.

Go to Service Management – Automatic Case Topics Analysis Settings

Create a new Topic model record

Create a related Topic Model Configuration record.

It auto populates the Topic Determination Fields which we can edit\add.

Specify the configuration record created in the Configuration lookup of Topic model record.

Click on Test to the configuration.

Build Execution History tab shows the status of the test run.

The build can be scheduled.

Once we have tested the configuration we can then activate the model.

Once Activated, we can them manually trigger the build using Build button

We can check the status of the build in the build execution history tab. Below record shows the build to be succeeded, duration it took i.e. 6 minutes, number of records it synchronized i.e. 159 and topics identified as 9.

To see it in action, go to Active Cases view and select Case Topics chart which lists the topics.

Hope it helps..

Configure Dynamics 365 and Azure Service Bus Integration (using TwoWay relay, Azure Aware Plugin and listener)

Let us pick up from where we left in the previous post and implement two way relaying through which we can get the response back from the listener.

https://nishantrana.me/2017/03/22/configure-dynamics-365-and-azure-service-bus-integration-using-oneway-relay-and-listener/

First let us update the Service Endpoint Registration, change the designation type to TwoWay, it would also ask to enter the SAS Key. Copy it from Azure and paste it.

Update the listener windows application created in the previous post to implement ITwoWayServiceEndpointPlugin

Use the below code to create the custom azure aware plugin.

Get the service endpoint id from the Properties window of the Service End Point registered.

Register the assembly and add the Post Create Synchronous Lead Step to it.

As we are using trace service to log the response, set All for Enable logging to plugin-trace log option from Administration – System Setting – Customization.

Start the listener windows application and to trigger the plugin, create the lead record

We can see the execute method being called from Azure Service bus on create of Lead record.

The message being returned from listener application to the plugin.

The newly created lead record.

The trace message within the plugin –

Plugin Trace log with the response received from the listener –

Hope it helps..

Configure Dynamics 365 and Azure Service Bus Integration (using OneWay relay and listener)

Continuing our previous post

https://nishantrana.me/2017/03/22/configure-dynamics-365-and-azure-service-bus-integration-through-queue-and-queueclient/

Here we’d add a new Shared Access Policy in the Azure Service Bus.

We can copy the connection string

Paste it in Service Endpoint registration dialog box of Plugin Registration tool

Change the designation type to OneWay, use https for the namespace address.

Register a step for creation of lead

Now we go and create a lead record, which triggers our plugin and creates a system job for it.

The system job fails as we do not have any active listener at the end point.

Now let us create a simple windows application which will act as listener.

Basically, we need to implement IServiceEndPointPlugin Interface, create a Service Host, define a new transportclientendpointbehaviour with shared access signature token provider, use WS2007HttpRelayBinding in our service end point.

Now run the listener application, and create a lead record in CRM.

We can see the break point hit in our listener application’ Execute method. Execute method is invoked whenever a message is posted to the service bus by Microsoft Dynamics 365.

System Job also shows the status as succeeded as we had our listener registered to the endpoint and running.

The helpful post

http://www.crmviking.com/2016/10/microsoft-crm-azure-service-bus-part-3.html

https://blogs.msdn.microsoft.com/swetagu/2016/04/12/crm-azure-service-endpoint-and-listener-deep-dive/

http://iunknownme.com/blog/2015/05/27/dynamics-crm-integration-using-azure-service-bus-part-i-using-service-bus-relays/

Hope it helps.

Configure Dynamics 365 and Azure Service Bus Integration (through Queue and QueueClient)

Let us configure Dynamics 365 and Azure Service Bus integration.

Here we would implement a basic scenario, every time a lead is created in CRM we’d pass this execution context information to the queue. The app then reads and shows the information.

As a first step, we need to register a service end point through plugin registration tool.

Here we need to provide the connection string

So, let us create SAS configured Azure service bus namespace and a queue in it.

Go to portal

https://portal.azure.com

Search for Service Bus, provide the required details and click on Create.

Next, we’d create a queue. Inside Service Bus go to Queues and click on plus button create a Queue

Next inside the queue we need to go to Shared Access Policy settings and click on Add button to add a new SAS Key

Next click on connection strings, followed by Add button to add a new SAS Key.

This creates the key. Now copy the connection string.

Paste the connection string in the Plugin Registration tool

It will auto populate all the details. Now click on Save.

This adds a new service end point

Now register a new step – Entity – Lead and Message – Create.

Now to trigger it let us create a lead record in CRM.

A corresponding System Job will have the status.

Back in our queue we can see 1 new message added to it.

To read the message, let us create a simple windows application.

Install the WindowsAzure.ServiceBus package.

The source code for the queue. Here the connection string will be the same which we had specified in the plugin registration tool. The message body is of type RemoteExecutionContext.

The output.

Hope it helps..