• 更改Dynamics 365 Customer Engagement本地部署的高级配置


    我是微软Dynamics 365 & Power Platform方面的工程师罗勇,也是2015年7月到2018年6月连续三年Dynamics CRM/Business Solutions方面的微软最有价值专家(Microsoft MVP),欢迎关注我的微信公众号 MSFTDynamics365erLuoYong ,回复346或者20190718可方便获取本文,同时可以在第一间得到我发布的最新博文信息,follow me!

    在实施项目的时候,Dynamics 365数据量比较多,展示的图表(chart)显示这个错误,

    AggregateQueryRecordLimit exceeded.  Cannot perform this operation.

    这个错误的意思就是聚合的记录超过了高级配置AggregateQueryRecordLimit字段的值,操作终止。

    这个高级配置项目AggregateQueryRecordLimit在哪儿?它不像组织属性那样在组织数据库中,如 更改组织属性-以更改maxrecordsforexporttoexcel为例 ,而是在 MSCRM_CONFIG 数据库的 [dbo].[DeploymentProperties] 表中,有哪些项目呢,我这里以我自己的本地部署的Dynamics 365 Customer Engagement 版本 1612 (9.0.3.7) (DB 9.0.3.7) (本地) 为了,通过如下SQL查出来。

    SELECT [ColumnName]
          ,[BigIntColumn]
          ,[IntColumn]
          ,[SmallIntColumn]
          ,[TinyIntColumn]
          ,[BitColumn]
          ,[FloatColumn]
          ,[DateTimeColumn]
          ,[SmallDateTimeColumn]
          ,[NVarCharColumn]
      FROM [MSCRM_CONFIG].[dbo].[DeploymentProperties] 
      ORDER BY [ColumnName]

    我这里截图出来部分结果如下:

    如何更改呢?根据文档 Use Advanced Configuration Settings (ConfigDB) 可以用 RetrieveAdvancedSettingsRequest 消息来查找,然后使用 UpdateAdvancedSettingsRequest 消息来更新。若是用这两个消息来处理,程序需要引用 Microsoft.CrmSdk.Deployment ,我这里亲自测试有效的代码如下:

                DeploymentServiceClient deploySvc = Microsoft.Xrm.Sdk.Deployment.Proxy.ProxyClientHelper.CreateClient(new Uri("https://demo.luoyong.me/XRMDeployment/2011/Deployment.svc"));
                deploySvc.ClientCredentials.Windows.ClientCredential = new NetworkCredential("crmadmin", "Paseewxw", "luoyong.me");
                ConfigurationEntity entity = new ConfigurationEntity();
                entity.LogicalName = "Deployment";
                entity.Attributes = new Microsoft.Xrm.Sdk.Deployment.AttributeCollection();
                entity.Attributes.Add(new KeyValuePair<string, object>("AggregateQueryRecordLimit", 100000));
                UpdateAdvancedSettingsRequest request = new UpdateAdvancedSettingsRequest();
                request.Entity = entity;
                deploySvc.Execute(request);

    更方便的是使用PowerShell命令来更新,我这里根据  的文章 Microsoft Dynamics CRM 2013 Change Deployment Settings via PowerShell 稍作更改可以使用如下代码:

    $itemSetting = new-object 'System.Collections.Generic.KeyValuePair[String,Object]'("AggregateQueryRecordLimit",50000)
    $configEntity = New-Object "Microsoft.Xrm.Sdk.Deployment.ConfigurationEntity"
    $configEntity.LogicalName="Deployment"
    $configEntity.Attributes = New-Object "Microsoft.Xrm.Sdk.Deployment.AttributeCollection"
    $configEntity.Attributes.Add($itemSetting)
    Set-CrmAdvancedSetting -Entity $configEntity

    最后一个方法不推荐使用,但是也可行,就是用SQL来更新,记得更新后需要对CRM的Web 站点对应的应用程序池执行Recycle,当然也可以用执行 IISRESET代替Recycle。

      UPDATE [MSCRM_CONFIG].[dbo].[DeploymentProperties] 
      SET IntColumn = 50000 
      where ColumnName = 'AggregateQueryRecordLimit'
  • 相关阅读:
    关于点击率模型,你知道这三点就够了
    【AI】Computing Machinery and Intelligence
    MATLAB 的函数句柄
    MATLAB 的unique函数——数组矩阵的唯一值
    MATLAB 的数据导入与导出
    MATLAB 的函数
    MATLAB 向量
    MATLAB 的break语句和continue语句
    MATLAB 的循环语句
    MATLAB 的条件分支语句
  • 原文地址:https://www.cnblogs.com/luoyong0201/p/Update_Dynamics_365_Customer_Engagement_Advanced_Configuration_Setting.html
Copyright © 2020-2023  润新知