Thursday, May 14, 2009

Record count per page For Microsoft Dynamics CRM 4.0

All you know that maximal records quanity is 250. I have wrote a little plugin which increases this count to 1000.

Idea of plugin - is to catch Execute message and change quantity of records per page.
Here the code of plugin:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.Crm.Sdk;
using Microsoft.Crm.SdkTypeProxy;
using Microsoft.Win32;
using System.Xml;
using Microsoft.Crm.SdkTypeProxy.Metadata;
using Microsoft.Crm.Sdk.Metadata;

namespace TestPlugin
public class RecordCounterExtender : IPlugin
public RecordCounterExtender(string config, string secureConfig)

#region IPlugin Members

public void Execute(IPluginExecutionContext context)
if (context.MessageName == "Execute" && context.InputParameters.Contains("FetchXml"))
XmlDocument indoc = new XmlDocument();

indoc.DocumentElement.Attributes["count"].Value = "1000";
context.InputParameters["FetchXml"] = indoc.OuterXml;



Here the result:

Step of plugin must be registered as a Pre Execute.