How to get only recently modified records for integration from Dynamics CRM using Azure Function C#.

Hello everyone in this blog we will see how we can query only recently modified data from dynamics CRM for our integration using Azure function in C#.

Step 1:
Open visual studio and create azure function, you can create an HTTP triggered function if you want it to run on a certain event or a timer trigger function that will run at specific times.

Step 2:

Install following packages to your solution.

Step 3:

The first task is to connect to our Dynamics CRM. We will use OAuth for connection, for that copy following code section to your function.

Note: Service root URL can be found in advance settings inside developer options.

Step 4:

Now next step is to use fetch XML query to get recent records. Please note that you can put any condition as per your requirement. Here I want to query yesterday’s records for integration.

Fetch XML:

Step 5:

Now we need this data in JSON format so we need to serialize it first. For that, I have created an account class that has all the attributes we will first assign them their values and then convert that object to JSON.

Full Code:

In this way, you can use fetch XML to get recent records using the Azure function. Hope this helps.



Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store