Tuesday, March 16, 2021

Generate FetchXML queries Using Advanced Find.

1. Advanced Find is a very rich feature of Dynamics 365, if you are already familiar with then just go ahead and start querying else you can access it by clicking the filter symbol in the top right navigation bar of your Dynamics 365 instance.

2. A window will pop up that will allow you to build a query using a WYSIWYG editor. Once you have defined a query you can click the Download Fetch XML button in the ribbon to get a file containing the query that can be used in your code.


3. Open the downloaded file with notepad and the query will look like the one below.
 
<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
    <entity name="account">
    <attribute name="name" />
    <attribute name="primarycontactid" />
    <attribute name="telephone1" />
    <attribute name="accountid" />
    <order attribute="startedon" descending="true" />
    <filter type="and">
      <condition attribute="name" operator="like" value="C%" />
    </filter>
  </entity>
</fetch>

4. Now that we have a FetchXML query you can begin working.


That's it... Thank You...

No comments:

Post a Comment