Don’t Forget the Power of Under!

 Don’t Forget the Power of Under!

Year after year, we have seen the FetchXML language evolve to provide Dynamics 365 users more and more functionality. This language of course is the one behind the user-friendly querying tool of Advanced Find, which offers many powerful options to filter your data.

A condition that became available with the release of CRM 2015 was Under. This condition returns all records under the referenced record in the hierarchy of its entity context. Please refer to “Hierarchy Visualization in Dynamics CRM 2015” to better understand hierarchy in CRM, but in the meantime, let’s discuss a common business requirement that Under can address.

Let’s focus on the out-of-the-box hierarchy setup with Account – the parent-child relationship within Account that supports the concept of Sub-Accounts. Say we have Account Adventure Works with Adventure Works Chicago and Adventure Works New York as Sub-Accounts.

Of course, we also have another parent-child relationship from Accounts being the Contact entity, Contacts being related directly to one Account. For our example, let’s say three Contacts are linked to Adventure Works, two with Adventure Works Chicago, and one with Adventure Works New York. What do we do if we want to see all six Contacts of Adventure Works, regardless if they are linked to the actual Account or a Sub-Account?!

Behold the power of Under, which we can utilize even across parent-child relationships!

071417 1454 DontForgett1 Don’t Forget the Power of Under!

We can see the from the simple Advanced Find query above, we can look for Contacts, where their related Account (“link-entity” via the Company Name attribute), is Under our parent Account Adventure Works. This quickly gives us that list of six Contacts that are all linked to Adventure Works.

Here’s a look at the FetchXML behind the scenes, with the beauty of link-entity and Under highlighted:

operator=”under”</strong> uiname=”Adventure Works” uitype=”account” value=”{account
guid}” />

Next time a similar requirement arises, please don’t forget what Under can do for you. Note that this example can be related to other related entities that have proper parent-child relationships and hierarchy configuration set up correctly.

Happy CRM’ing!

Let’s block ads! (Why?)

PowerObjects- Bringing Focus to Dynamics CRM