如何在Pre-Update插件中将字段设置为null

时间:2012-05-30 12:20:09

标签: dynamics-crm dynamics-crm-2011

我为Case实体开发了一个Pre-Update插件。在这个插件中,我想将字符串字段设置为新值。 如果新值不为null,它将顺利运行。但是如果新值为si null,则忽略它。

这有效:

Incident caseTarget = ((Entity) localContext.PluginExecutionContext.InputParameters["Target"]).ToEntity<Incident>();
caseTarget.ProductSerialNumber = "new value";

执行插件后, ProductSerialNumber 字段的值为“new value”。

这不起作用:

Incident caseTarget = ((Entity) localContext.PluginExecutionContext.InputParameters["Target"]).ToEntity<Incident>();
caseTarget.ProductSerialNumber = null;

执行插件后, ProductSerialNumber 字段仍然是旧值。

如何将目标字段设置为null?

0 个答案:

没有答案