【发布时间】:2011-08-12 13:17:28
【问题描述】:
我正在处理插件上下文中默认实体 (email) 的自定义(扩展)属性,尽管该方法适用于创建 (.Add()),但它不适用于更新(也不是.Update() 方法关联)。这是实际代码:
public class EmailPreCreateHandler : IPlugin
{
DynamicEntity dynamicEntity;
if (context.InputParameters.Properties.Contains("Target")
&& context.InputParameters.Properties["Target"] is DynamicEntity)
{
dynamicEntity = (DynamicEntity)context.InputParameters.Properties["Target"];
if (dynamicEntity.Name != EntityName.email.ToString()) { return; }
}
else { return; }
try
{
if (dynamicEntity.Properties.Contains("new_property1")
|| dynamicEntity.Properties.Contains("new_property2"))
{
var new_property3 = new CrmBooleanProperty("new_property3", new CrmBoolean(true));
dynamicEntity.Properties.Add(new_property3);
}
}
catch (SoapException exception)
{
throw new InvalidPluginExecutionException(
"An error occurred with the plug-in.", exception);
}
}
}
我想知道我是否应该做这样的事情来让它工作?
dynamicEntity.Properties.Remove(new_property3);
dynamicEntity.Properties.Add(new_property3);
注册详情
(大会)
- 位置:数据库
(步骤)
- 消息:创建
- 主要实体:电子邮件
- 次要实体:无
- 过滤属性:所有属性
- 在用户上下文中运行:调用用户
- 执行顺序:1
- Eventing Pipeline 执行阶段:Pre Stage
我将非常感谢任何反馈。非常感谢,
【问题讨论】:
-
注册有什么用?前/后?哪条消息?
-
@ckeller:感谢您的贡献 - 我已经用插件注册详细信息更新了帖子。