LIMITATION NUMBER OF ALLOWED LINK ENTITY IN QUERY

In this quick post, I will talk about a limitation you might face when working in D365 CE which is exceeding the maximum number of link entities in a query.

The exception message that you will receive is the following: Error : Number of link entities in query exceeded maximum limit. where the maximum number of link entities is 10.

You get this error in different scenarios
  1. In a view when you add fields of more than 10 related entities because they are reflected as link entities with outer join to the main entity
    <OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">.........
    <Message>Invalid FetchXml on SavedQuery.Update.</Message>.........
    <ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
    <HelpLink i:nil="true" />
    <Message> The column, fetchxml, has invalid fetch. Error : Number of link entities in query exceeded maximum limit. </Message>.........
    </OrganizationServiceFault>


  2. In advanced find when you do a query with more than 10 associations or when you add fields of more than 10 related entities


  3. When executing a FetchXml with more than 10 link-entities
  4. When executing a WebAPI call with &$expand with more than 10 related entities

The reason why the CRM is limiting the link entities in the query, is the performance impact on the request.

For the meanwhile, there is no solution to overcome this limitation other than decreasing the number of link entities in your request and it is not obvious if Microsoft is willing to allow adding more than 10 related entities in a query.


Hope This Helps!

Comments

Post a Comment

Popular posts from this blog

DYNAMICS 365 HOW TO HIDE RECENT RECORDS FOR LOOKUP FIELD IN UCI

SEARCH BY GUID IN DYNAMICS 365

SAVE FORM IN DYNAMICS 365 JAVASCRIPT