Extend 10000 record limit when exporting to Excel in CRM 2013

 

Hello everyone!

In this article I will talk about how to extend 10000 record limit when exporting to Excel in CRM 2013.

The export limitation with 10,000 records from Microsoft Dynamics CRM to Excel is sometimes may be very annoying for users and developers.

There are several ways to handle this problem.

 

1) Updating CRM Database

Note: Editing the 10,000 value is unsupported to the Dynamics CRM database, so please beware of this information when you are doing this update. Especially if it is a production environment you are working on.

Here are the steps to extend 10,000 limit:

    1. Open the SQL Server Management Studio and connect to the appropriate sql instance
    2. Select the CRM database you want to make the change
    3. Look for the OrganisationBase table in the CRM organisations database (OrganisationNAME_MSCRM)
    4. Update the MaxRecordsForExportToExcel to reflect the limit you would like CRM to export to.
    5. Save the DataBase Change
    6. Proceed with an IIS reset (Run Command Prompt as Administrator and type iisreset)

And that’s it!

Now that you can export more than 10,000 records at a time from Dynamics CRM.

 

2) Modifying Registy with some code

You can use the following code to modify the Organization attribute maxrecordsforexporttoexcel

public static void Main(string[] args) {
	OrganizationServiceProxy _serviceProxy = null;
	IOrganizationService _service;

	Uri crmURI = new Uri("https://{ORGANIZATION}.api.{crmregion}.dynamics.com/XRMServices/2011/Organization.svc");

	ClientCredentials clientCredentials = new ClientCredentials();
	clientCredentials.UserName.UserName = "username";
	clientCredentials.UserName.Password = "password";

	using(_serviceProxy = new OrganizationServiceProxy(crmURI, null, clientCredentials, null)) {
		QueryExpression query = new QueryExpression();
		query.EntityName = "organization";
		query.ColumnSet = new ColumnSet() {
			AllColumns = true
		};

		_service = (IOrganizationService) _serviceProxy;

		EntityCollection entities = _service.RetrieveMultiple(query);
		if (entities.Entities.Count == 1) {
			if (entities.Entities[0].Attributes.Contains("maxrecordsforexporttoexcel")) {
				entities.Entities[0].Attributes["maxrecordsforexporttoexcel"] = 20000;
				_service.Update(entities.Entities[0]);
			}
		}
	}
}

Note: Modifying Registy this way to extend 10,000 record limit is a supported update to CRM unlike Updating CRM Database we covered above.

 

3) Using the tool

If you are not satisfied what we covered above The Tool Increases the 10000 record limit when exporting to Excel for Dynamics CRM can do the job for you. Just connect to your CRM environment as described in the link and change the limit as you desired. That’s it!

Note: Using this tool is also supported to CRM.

 

Summary: There are 3 ways to Extend 10000 record limit when exporting to Excel in CRM 2013.

  1. Updating CRM Database (unsupported)
  2. Modifying Registy with some code (supported)
  3. Using the tool (supported)

 

Remarks: This update works perfect but might cause some performance issues when users across the organization are exporting hundreds of thousands of records simultaneously.

 

I hope you enjoyed this tutorial.

See you 🙂

 

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *