AI摘要

文章介绍了如何通过编写Plugin代码来解决微软CRM记录列表每页显示记录数量限制的问题。通过修改FetchXml中的count属性值,可以将每页显示的记录数量增加到1000个,方便进行批量操作。文章还提供了Plugin的注册方法。
文章介绍了如何

微软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



最后修改:2010 年 12 月 09 日
点赞的人是最酷的