When querying CRM data using either QueryExpressions, FetchXML or Linq, you might receive the following error message when joining more that 10 entities:
Number of link entities in query exceeded maximum limit
That is very annoying. Why would they do that? Does Microsoft assume that all CRM consultants are dumb idiots who don’t know what they’re doing and need limits?
Anyway, here’s how to raise the limit from 10 to 20, by adding a row in the DeploymentProperties table of the MSCRM_Config database. This is of course unsupported.
declare @guid uniqueidentifier
set @guid =
(Select top 1 Id From MSCRM_CONFIG.dbo.DeploymentProperties)
— Add row in DeploymentProperties table
INSERT INTO MSCRM_CONFIG.dbo.DeploymentProperties(Id,ColumnName,IntColumn,Encrypted)
select * from MSCRM_CONFIG.dbo.DeploymentProperties where ColumnName = ‘QueryLinkEntityLimit’