Wednesday, 12 July 2017

{know-how}Dynamics CRM 365 - Query Hierarchical data - D365

Hierarchical querying, an interesting way of retrieving data for analysis, transforming and reporting. In latest version of CRM, we can use fetchxml to query and retrieve hierarchical data.

The hierarchical data retrieval in fetchxml can be achieved using following filter condition operators
  • above
  • eq-or-above
  • under
  • eq-or-under
  • not-under
  • eq-owneduseroruserhierarchy
  • eq-useroruserhierarchyandteams
Make sure the specific relationship is hierarchy enabled.
Sample Scenario:
Find all child account hierarchy for the parent account.

In the below fetchxml the highlighted operator called under will fetch all the accounts that are under the given accounts hierarchy.

    <entity name="account" >
        <filter type="and" >
            <condition attribute="accountid" operator="under" value="a9df53b3-e31c-e711-8108-5065f38af901" />

Try all the above filter operators and also refer below MSDN article for more info and do not forget to go through restrictions.

Happy learning!

1 comment:

  1. I am regular reader of your blog and no doubt it all stuff is awesome. The best thing about your sharing and posting is that you always provide content that is helpful for both the newbie and experts.CRM Software Development


Contact Form


Email *

Message *