Using a FetchXML statement as a Dynamics CRM DataSource

Extracting data from Dynamics CRM using fetchxml and the DS3' FetchXml provider

This article describes how to extract data from a Dynamics CRM Advanced Find or View using DS3's 'Microsoft Dynamics CRM 2011/ 2013 / FetchXml' provider.

Exporting the FetchXml from a Advanced Find query.

Use the Advanced Query feature in Dynamics CRM and export the xml by clicking the 'Download Fetch XML' button in the advanced find dialog.

Advanced Find

Open the downloaded file in Notepad

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
    <entity name="contact">
        <attribute name="fullname" />
        <attribute name="contactid" />
        <attribute name="websiteurl" />
        <attribute name="emailaddress1" />
        <order attribute="fullname" descending="false" />
        <filter type="and">
            <condition attribute="websiteurl" operator="not-null" />
        </filter>
    </entity>
</fetch>

Copy the above xml as it is used to extract data from Dynamics CRM in DS3.

Creating a connection to Dynamics CRM

Using the 'Microsoft Dynamics CRM 2011/ 2013 / FetchXml' provider (the provider also works with Dynamics Online) connect to the instance of Dynamics CRM you want to extract data from pasting the FetchXml in the FetchXml property in the dialog.

Connect to CRM

Click OK and Datasource (A) will be connected to Dynamics CRM and the columns from you FetchXML will be used as the source columns. Select the columns by clicking on the checkboxes and then preview the data.

Preview A

We can export this data to a CSV file easily by using the 'Create CSV File' feature from the Tools menu where you just set the new csv file location.

Target CSV

Just click Compare A->B, then press 'Synchronise' then press 'Start'.

Compare A to B

This will synchronise the data extracted from the fetchxml into the CSV file. You can save this project and schedule it to extract daily, hourly or weekly using the Windows Scheduler or just Ad-Hoc when required.


Can't find the answers you're looking for? Contact our support team and we'll personally get back to you as quickly as we can.