0
即时通讯新属性。我创建了两个实体:订单和产品。在订单实体有查看产品实体的字段。我试图通过查找字段从产品获取产品数量,并将其粘贴到订单实体中的字段。这里是我试过的代码:的Microsoft Dynamics CRM插件:在CRM检索查找场
if (context.InputParameters.Contains("Target") && context.InputParameters["Target"] is Entity)
{
Entity entity = (Entity)context.InputParameters["Target"];
if (entity.Attributes.Contains("new_productname"))
{
Entity productreference = service.Retrieve("new_callistyproduct", ((EntityReference)entity["new_productname"]).Id, new ColumnSet(true));
if (productreference.Attributes.Contains("new_productquantity"))
{
if (entity.Attributes.Contains("new_numberofproduct"))
entity["new_numberofproduct"] = productreference.GetAttributeValue<Decimal>("new_productquantity");
else
entity.Attributes.Add("new_numberofproduct", productreference.GetAttributeValue<Decimal>("new_productquantity"));
}
}
}
我希望这个插件能够在我创建新记录时工作。所以我把这个插件注册为预创建事件。但是,当我尝试创建一个记录。该插件没有从productquantity字段中检索值。 所以,我试图将此插件作为Pre-Update事件运行。在我以前创建的记录,我改变从产品A到B.产品及其工作查找值,该插件检索产品B.
的问题是产品的数量值,我应该怎么做,如果我希望这个插件也适用于预创建事件。
感谢
是查找插件在预操作创建阶段被触发时填充了“new_productname”? –