CRM 2015 更新 - 插件错误 - 'Changing security attributes is not allowed in stage 20 plugins'
CRM 2015 update - plugin error - 'Changing security attributes is not allowed in stage 20 plugins'
当我尝试在 post 更新插件阶段创建另一种类型的实体记录时,我遇到了 "Changing security attributes is not allowed in stage 20 plugins" 错误。
它在 Dynamics CRM 2013 SP1 CRM 中运行良好。
将 CRM 2013 更新为 CRM 2015 后出现此错误
从预创建中删除逻辑并将其移动到另一个实体的post创建中。那么它将正常工作
从插件中删除不需要的属性 images.only select 您在 plugin.You 中需要的属性可以在您注册插件时设置它(不要勾选所有属性复选框)。删除安全相关属性(所有者、修改者、创建于)
当组织迁移到 CRM 2015 时,有些人可能会在插件步骤中遇到此错误。
原因:
- 您在记录创建前更改记录的所有权
分辨率:
- 大多数解决方案都说将插件更改为 Post-operation 阶段,但这对于您的插件可以执行的某些 actions/checks 没有意义。
- 因此,您可以做的是在 运行 赋值操作之前检查管道阶段。
https://msdn.microsoft.com/en-us/library/gg327941.aspx#bkmk_PipelineStages
示例代码:
//Runs on the Pre-Validation step, when a Contact is created
if (context.Stage == 10)
{
if (!targetEntity.Attributes.Contains("parentcustomerid"))
{
throw new InvalidPluginExecutionException("Message to show....");
}
try
{
var accountOwner = (from a in orgServiceContext.AccountSet
where a.Id == targetContact.ParentCustomerId.Id
select a).Single();
targetEntity.Attributes["ownerid"] = new EntityReference("team", accountOwner.OwnerId.Id);
targetEntity.Attributes["owningbusinessunit"] = new EntityReference("businessunit", accountOwner.OwningBusinessUnit.Id);
}
catch
{
throw new InvalidPluginExecutionException("Message to show...");
}
}
找到另一个解决方案:将您的插件步骤移至预验证。
当我尝试在 post 更新插件阶段创建另一种类型的实体记录时,我遇到了 "Changing security attributes is not allowed in stage 20 plugins" 错误。 它在 Dynamics CRM 2013 SP1 CRM 中运行良好。 将 CRM 2013 更新为 CRM 2015 后出现此错误
从预创建中删除逻辑并将其移动到另一个实体的post创建中。那么它将正常工作
从插件中删除不需要的属性 images.only select 您在 plugin.You 中需要的属性可以在您注册插件时设置它(不要勾选所有属性复选框)。删除安全相关属性(所有者、修改者、创建于)
当组织迁移到 CRM 2015 时,有些人可能会在插件步骤中遇到此错误。 原因:
- 您在记录创建前更改记录的所有权
分辨率:
- 大多数解决方案都说将插件更改为 Post-operation 阶段,但这对于您的插件可以执行的某些 actions/checks 没有意义。
- 因此,您可以做的是在 运行 赋值操作之前检查管道阶段。 https://msdn.microsoft.com/en-us/library/gg327941.aspx#bkmk_PipelineStages
示例代码:
//Runs on the Pre-Validation step, when a Contact is created
if (context.Stage == 10)
{
if (!targetEntity.Attributes.Contains("parentcustomerid"))
{
throw new InvalidPluginExecutionException("Message to show....");
}
try
{
var accountOwner = (from a in orgServiceContext.AccountSet
where a.Id == targetContact.ParentCustomerId.Id
select a).Single();
targetEntity.Attributes["ownerid"] = new EntityReference("team", accountOwner.OwnerId.Id);
targetEntity.Attributes["owningbusinessunit"] = new EntityReference("businessunit", accountOwner.OwningBusinessUnit.Id);
}
catch
{
throw new InvalidPluginExecutionException("Message to show...");
}
}
找到另一个解决方案:将您的插件步骤移至预验证。