Fetch in 2011 has added some really nice features.  One of those nice features is the total record count of the applied filter.  In 4.0 you had to execute two fetch statements, but now with 2011 you can add the ReturnTot alRecordCount attribute.

<fetch mapping='logical' count='25' returntotalrecordcount='true'>
   <entity name='account'>
      <attribute name='accountid' />
      <attribute name='accountnumber' />
      <attribute name='address1_city' />
      <attribute name='address1_telephone1' />
      <attribute name='name' />
      <order attribute='name' />
         <condition attribute='address1_city' operator='like' value='Greenville%' />


Upon executing this fetch statement with the ReturnTotalRecordCount  attribute set to true, the “TotalRecordCount” is returned.


Note: This is not the total number of entities, it is the total number of records that match the filter.

Post by: Paul Way, Customer Effective

FetchXML 2011 -Total Record Count is a post from: CRM Software Reviews at the CRM Software Blog

Related posts:

  1. Parsing and Consuming the CRM 2011 SOAP Service Inside JavaScript
  2. Execute Fetch from JavaScript in CRM 2011
  3. Preparing for 2011: Filtered Lookup in Microsoft Dynamics CRM 2011