Search code examples
.netdynamics-crm-2011dynamics-crm

What is the maximum number of records can I store in one EntityCollection?


Background: I'm writing an application to retrieve and modify 1 field of all account records. To do that, I retrieve all account records first and store them in an EntityCollection. Then I iterate over that Collection and make my changes. Since I have around 30000 account records, I use the workaround in the following link to avoid CRM's 5000 records limitation.

However, I wonder if it is ok to store that many records in 1 EntityCollection object? What is the maximum number of records can I store in 1 EntityCollection?

I'm using CRM2011 on-premise, SQL Server 2008R2 and NetFramework 4.0.


Solution

  • There is no limit on an EntityCollection outside of your process running out of memory.

    If you want to pull them all down, then update them all, you'll want to only pull down the fields you need to help with the amount of time this will take to run and overall memory use. When you go back to update CRM you can use ExecuteMultipleRequest to batch the UpdateRequests and there you can only send 1000 at a time.

    Another way to do it would be pulling down and updating in batches, so that you don't have all 30k in memory at one time.