Integration with Microsoft Dynamics 365 using Azure Logic App Service

In this post I’ll discuss Data Integration using Azure Logic App Service, we will create a Logic app that gets triggered when a case is created in Dynamics 365 and inturns creates a work item in Visual Studio Team services for the team to work on.

Logic App workflow is built using series of actions and Connectors, and has its own JSON based workflow definition schema, for details refer to my blog on The Basics of Azure Logic Apps Schema and Codeview editing

Pre-requisites
  • Microsoft Dynamics 365 Online instance (On-premise instance could be used as well using Azure Data Gateway)
  • Microsoft Azure subscription for creating a Logic APP (If you don’t have an Azure subscription you can either use Try a Logic App feature which creates a logic app for an hour or you may sign up for a Trial account.)
  • Visual Studio Team services account (SignUp link).

Integration Steps
  • Start by Creating a Logic App from the Azure Marketplace.

Once you have created a Logic App, you will be presented with Logic App Designer, here you can choose to build your data integration using one of the existing templates. For our purpose, we will start with a blank logic app.

  • Next, we need to define our workflow, the first step in the workflow is to define the trigger condition, we will use the Dynamics 365 Connector’s “when a Record is created” as a trigger. once you complete the trigger setup by signing in, it will create an “API Connection” of type “dynamicscrmonline” and add it to your resource group.

Dynamics 365 Connector

Once connected, select the organization and the entity(Case) as per your trigger condition. you can also specify the frequency at which changes are being polled. Currently, connector only supports polling based trigger but in future, it is supposed to have support for Event-based triggers as well.

  • Our Next step is creating a Bug in Visual Studio Team services and we can use the OOB Visual Studio Team connector to do so, But the connector support is limited to the default fields and that could be a challenge when integration requires mapping with custom fields. As such we will use HTTP Connector and leverage Visual Studio Team services REST API .

In order to use VSTS Rest API with the Logic app, we will need a PAT(Personal access token) key to be generated, Instruction for generating PAT could be found here.

  • Add HTTP action as the next step and specify PATCH as the method, specify the rest URL and the Body of the message. use the values from trigger action as appropriate using dynamic Expression builder.

For authentication select “Basic”, User could be set to any string and password should be the PAT Key.

I have created a BUG ID field for the CASE entity in CRM and will update it with the Bug Id as a response. for this I will use Update record action for Dynamics 365 connector.

The Dynamics 365 connector update record has a bug (need to validate if this has been fixed in the latest connector update) because of which it mandates all the required field while update, The workaround is to switch the view to Code behind, correct the update action input and save.

Run:

Once completed trigger the Logic app by creating a case in CRM, You can validate the Integration runs from the overview window or the Runs History, If the JOb has failed it can be submitted again by using the Resubmit option.

Azure Logic app has many Monitoring Options Of which Alert Rules are of great value, Alert rules could not only be configured the notify the system administrators as per failure threshold but can also be used to trigger another Logic app. More about Logic Apps and Microsoft Dynamics 365 Integrations in subsequent blogs.

3 thoughts on “Integration with Microsoft Dynamics 365 using Azure Logic App Service”

  1. Very nice post. I just stumbled upon your weblog and wished to say that I have truly enjoyed surfing around your blog posts. In any case I will be subscribing to your rss feed and I hope you write again very soon!

  2. whoah this blog is excellent i really like reading your articles. Keep up the good work! You already know, many individuals are hunting round for this info, you could help them greatly. |

Leave a Reply to Monte Ploense Cancel reply

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