Friday, October 25, 2013

Dynamics 2013 - FetchXML now supports left outer joins

Dynamics 2013 has now added support for left outer joins in FetchXML. So you can now easily do queries like get all the accounts with no contacts.

<fetch version="1.0" output-format="xml-platform" mapping="logical" distinct="false">
  <entity name="account">
    <attribute name="name" />
    <link-entity name="contact" from="parentcustomerid" to="accountid" link-type="outer">
      <attribute name="parentcustomerid" />
    </link-entity>
    <filter type='and'>
      <condition entityname="contact" attribute="parentcustomerid" operator="null"/>
    </filter>
  </entity>
</fetch>

No comments:

Post a Comment