Integrating Dynamics 365 with other systems has always been an interesting topic and we have used different methods to achieve this, either solutions available in the market or custom development however since Microsoft has introduced Logic Apps, things have gone a bit crazy…I know we can’t achieve everything in Logic Apps like we can in custom development however we can do a lot, especially if we want to run asynchronously operations.
Let’s take an example, we have a requirement where we will receive a JSON from an other system and depending on the criteria set in our Logic App and data receieved in JSON we want to update external system and also update our Dynamics 365 too.
We could achieve above by writing custom code however will definitely take us some time for development, testing and on the top of that maintenance.
To get started, first thing we need to do is login to Azure portal and go to All Resources or search for Logic Apps in search and create a blank Logic App
Give your logic app a name and all other required details and create it.
On next screen select Blank Logic App and then search for request (as below)
On next screen select ‘When a HTTP request is received’
This will give us a unique Logic App URL and we can use it anywhere we need to call this Logic App
At this point we must have JSON we are going to receive so that we can update our logic app with, in this example I am going to use following JSON in Logic App
"title": "example glossary",
"GlossTerm": "Standard Generalized Markup Language",
"Abbrev": "ISO 8879:1986",
"para": "A meta-markup language, used to create markup languages such as DocBook.",
"GlossSeeAlso": ["GML", "XML"]
Now click on ‘Use sample payload to generate schema’ and paste your JSON there and press on Done button
Then click on + New Step button, search for Http and select as below and then again HTTP
You will see a screen as below
We have selected above as we want to notify or update our third party or external system that we have received data or whatever the requirement is and therefore we have selected POST method
Uri is the url given to us by external or thirday party system (usually API)
In body, we have a sample JSON which third party or external system will accept to update their system and we are passing dynamic values from previous HTTP request (this is just a sample)
Until this point we have recieved data from third party or external system and update back third party or external system however we have not queried or updated Dynamics yet.
Next we want to get a contact where field abc is equal to data we recieved from step 1 i.e. http request
Search for Dynamics 365, select List Records, sign in to you D365 instance
This will bring your org and list of entities, select your required entity you want to fetch with the required query. In this example we want to search where name is equal to one of the field from previous step. Make sure you have single quotes on both sides of value if its a string data
At this point we have our contact from CRM which we want to update on Account entity, next step is to add a new action and search for Dynamics 365 and select Update a record action
As you can see in screenshot below, we want to update contact (from above step) on Account entity (find by external ref id from our JSON) – we will use Record identifier to find account record and then update contact on account
below is to update contact
Save your logic app and this will generate a URL which you can use to call this