Advertisements

Archive

Posts Tagged ‘AggregateQueryRecordLimit’’

Aggregate Query Record Limit Exceeded – Exception in CRM

October 16, 2014 Leave a comment

I was getting below exception when using FetchXML aggregation to compute Average of one of my entities field.

AggregateQueryRecordLimit exceeded.  Cannot perform this operation.

My Fetch XML :

<fetch distinct=’false’ mapping=’logical’ aggregate=’true’>

<entity name=’new-expenses’>

<attribute name=’new_gross’ alias=’gross_avg’ aggregate=’avg’ />

</entity>

</fetch>”;

Reason :

  • FetchXML Aggregation has a limitation, by default its limited to performing aggregate queries on less than 50,000 records.

Fix :

  • We cannot change this limit on CRM online
  • On onpremise, we can increase the limit by changing ‘AggregateQueryRecordLimit’ column value of ‘MSCRM_CONFIG.Deployment Properties’ table.
  • Refer this link on how to change.

Aggregation using Fetch XML

One of the major differentiator between Query Expression Vs Fetch Xml is that you can perform Aggregation on result set using Fetch XML.

The following aggregate functions are supported:

  • sum
  • avg
  • min
  • max
  • count(*)
  • count(attribute name)

Refer this link

🙂

Advertisements