微软CRM记录列表每页显示超过250个记录解决办法

该日志由 samool 发表于 2010-12-09 16:30:13

微软CRM记录列表每页显示记录数量只能在25、50、75、100、250中选择一个,有时候经常有需求需要在一页上显示超过250个记录,以便执行某些批量操作功能,比如批量删除、编辑、运行工作流等等;通过Plugin可以实现微软CRM记录列表每页显示超过250个记录,代码如下:

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


namespace RecordCounterExtender
{
    public class RecordCounterExtender:IPlugin
    {
        public void Execute(IPluginExecutionContext context)
        {
            if (context.MessageName == "Execute" && context.InputParameters.Contains("FetchXml"))
            {
                XmlDocument indoc = new XmlDocument();
                indoc.LoadXml((string)context.InputParameters["FetchXml"]);

                if (indoc.DocumentElement.Attributes["count"] != null)
                {
                    indoc.DocumentElement.Attributes["count"].Value = "1000"; //一页显示1000个记录
                    context.InputParameters["FetchXml"] = indoc.OuterXml;
                }
            }
        }
    }
}

Plugin注册方法:

2010082415335236.jpg

该日志标签: 微软crm, CRM, Plugin

上一篇: MSCRM 4.0 Plug-In
下一篇: MSCRM用Plugin实现自动编号功能

当前暂无评论 »

添加新评论 »