Saturday, 16 April 2016

Inner Join In FetchXML - FetchXML Query

In the below example, the FetchXML performs inner join on account and contact entity and returns contacts where accountid of account matches parentcustomerid of contact.
  1. <fetch version='1.0' mapping='logical' distinct='false'>
  2. <entity name='contact'>
  3. <attribute name='fullname'/>
  4. <link-entity name='account' to='parentcustomerid' from='accountid' link-type='inner'>
  5. <attribute name='name'/>
  6. </link-entity>
  7. </entity>
  8. </fetch>
  • To perform inner join in FetchXML query set following attributes in link-entity clause.
    • Set name attribute to logical name of related entity.
    • Set to attribute to linking attribute in primary entity.
    • Set from attribute to linking attribute in related entity.
    • Set link-type attribute to inner.
  • Now within link-entity clause specify attributes from related entity to retrieve
- See more at:

No comments:

Post a Comment