FetchXML language provide Dynamics 365
users with more and more functionality.
This language is behind the user-friendly querying tool of Advanced Find, which offers many powerful options to filter your data.
This language is 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 is ‘Under’.
This condition returns all records under
the referenced record in the hierarchy of its entity context.
For example, an Account record in CRM
could have a ‘Parent Account’ or many ‘Sub-Accounts’ or child accounts. It is
possible since CRM 2015 possible to display these relationships as a hierarchy
visualization. See attachment of a former note.
Out-of-the-box hierarchy setup with
Account – the parent-child relationship within Account supports the concept of
Sub-Accounts.
We have Account Adventure Works with
Adventure Works Chicago and Adventure Works New York as
Sub-Accounts.
We also have another parent-child
relationship from Accounts being the Contact entity, Contacts being related
directly to one Account.
For our example three Contacts are linked
to Adventure Works, two with Adventure Works Chicago, and one
with Adventure Works New York.
What do we do to see all six Contacts of Adventure
Works, regardless of whether those are linked to the actual Account or a
Sub-Account?!
Use the power of ‘Under’, even
across parent-child relationships.
From the s Advanced Find query above, look
for Contacts, where their related Account (“link-entity” via the Company
Name attribute), is Under our parent Account Adventure
Works. This gives a list of six Contacts that are all linked to Adventure
Works.
The FetchXML behind the scenes, with link-entity
and Under code in bold:
<fetch
version=”1.0″ output-format=”xml-platform” mapping=”logical” distinct=”false”>
<entity
name=”contact”>
<attribute
name=”fullname” />
<attribute
name=”contactid” />
<link-entity
name=”account” from=”accountid” to=”parentcustomerid” >
<attribute
name=”parentaccountid” />
<filter
type=”and”>
<condition
attribute=”accountid” operator=”under” uiname=”Adventure Works”
uitype=”account” value=”{account
guid}” />
guid}” />
</filter>
</link-entity>
</entity>
</fetch>
This example of use og Under can be related to
other related entities that have r parent-child relationships and hierarchy
configuration set up correctly
No comments:
Post a Comment
if you have any doubts, please tell me