Archive

Archive for October 16, 2014

Using ‘No Lock’ in FetchXML CRM

October 16, 2014 Leave a comment

In one of our requirement we are retrieving records using FetchXML and we observed fetch taking long time when there are more concurrent user access.

Reason:

  • Records are being updated by other users when I perform Fetch

Fix :

  • Set “no-lock=’true'” in the FetxhXML as below

<fetch mapping=’logical’ no-lock=’true’>

</fetch>

🙂

Categories: CRM Tags: , ,

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

🙂