How to – Get Total Count of records in CRM. (more than 5000)


For version 9.0 please check the below post

RetrieveTotalRecordCountRequest

https://dreamingincrm.com/2019/07/22/getting-entity-record-counts/

https://docs.microsoft.com/en-us/dotnet/api/microsoft.crm.sdk.messages.retrievetotalrecordcountrequest?view=dynamics-general-ce-9

Just sharing a sample code to get the total number of records (e.g. account here)

<br />
 IOrganizationService orgService = GetOrganizationService();</p>
<p> int totalCount = 0;</p>
<p> QueryExpression query = new QueryExpression("account");<br />
 query.ColumnSet = new ColumnSet();<br />
 query.Distinct = true;<br />
 query.ColumnSet.AddColumn("accountid");<br />
 query.PageInfo = new PagingInfo();<br />
 query.PageInfo.Count = 5000;<br />
 query.PageInfo.PageNumber = 1;<br />
 query.PageInfo.ReturnTotalRecordCount = true;</p>
<p> EntityCollection entityCollection = orgService.RetrieveMultiple(query);<br />
 totalCount = entityCollection.Entities.Count;</p>
<p> while (entityCollection.MoreRecords)<br />
 {<br />
 query.PageInfo.PageNumber += 1;<br />
 query.PageInfo.PagingCookie = entityCollection.PagingCookie;<br />
 entityCollection = orgService.RetrieveMultiple(query);<br />
 totalCount = totalCount + entityCollection.Entities.Count;<br />
 } </p>
<p> MessageBox.Show(totalCount.ToString());<br />

 

Hope it helps

Advertisements

Business Process Error while trying to open records in CRM 2015


Hi we were getting the below error while trying to open any record in CRM 2015

G

Turned out that by mistake one wrong extra step had got registered on RetrieveMultiple

ActivityFeeds.Plugins: ActivityFeeds.Plugins.ActivityClose]

[c824b80a-d392-e511-8114-3863bb356f90: ActivityFeeds.Plugins.ActivityClose: RetrieveMultiple of any Entity]

Removing this step fixed the issue.

Hope it helps.

Fixed – Microsoft Dynamics CRM Reporting Authoring Extension Setup – Setup cannot continue because there is a pending restart required error in CRM 2015


Hi,

Got the below error while trying to install the Report Authoring Extension for CRM 2015.

To fix the issue, open the log file, check for the registry path and delete it

Hope it helps !

2 is not a valid state code on product with Id – Error while trying to create a new Product record in CRM 2015 Upgraded Environment


Hi

Recently we upgraded one of our CRM 2013 Online to CRM 2015 Online Update 1. The approach was installing the solution from our dev to new CRM 2015 environment.

After the update when trying to create a new product we were getting the following error message

“2 is not a valid state code on product with Id 0977da8e-3368-e511-80fc-3863bb359f30”

We raised the support ticket and the resolution was to add the following line of code to the customization.xml file. It seemed that few of the State Code and Status Code were gone missing for the product entity.

Adding them back resolved the issue.

Hope it helps..

No plugins have been selected from the list. Please select at least one and try again error while trying to register Custom Workflow Activity in CRM 2013 Online.


Hi,

Update – Check if the class used for defining Plugin / Workflow Activitiy is PUBLIC

Was getting below error while trying to register Custom Workflow Activity in CRM 2013 Online.

The solution we found out was to use CRM 2015’s Plugin Registration Tool to register it.

Hope it helps.

Advertisements

The operation could not be completed because you do not have read access on some of the fields in {0} record error in CRM 2013\2015


Hi,

While trying to add a new quote record to an opportunity record, we were getting the below error

The issue turned out that the user was not having read access to one of the fields in the opportunity record configured through Field Level Security.

Hope it helps..