Tuesday 18 June 2013

FetchXML Outer Joins - CRM 2011, Opportunities and Customers.

Joins in fetchxml or the lack of joins can cause big problems in data returned if you do the wrong thing.

The following line of code run from within the context of an opportunity would return all opportunities that also have a Customer selected.

<link-entity name="account" from="accountid" to="customerid" visible="false" alias="accountid">
 
If you want to show all Opportunities regardless of whether a customer has been added or not then you need to add in link-type=”outer” as per below.

<link-entity name="account" from="accountid" to="customerid" visible="false" link-type="outer" alias="accountid">

Hope this helps

No comments:

Post a Comment

ADFS Timeout on Server 2012 for CRM 2011

This follows on from this Microsoft Guide http://social.technet.microsoft.com/wiki/contents/articles/7681.setting-the-adfs-timeout-for-crm...