当我尝试获取商机产品线实体内的扩展金额属性时,我遇到了问题。 如下我的要求是,在创建机会产品线时,我有一个后创建插件,它在扩展金额上应用折扣并创建另一条线,并使用新的折扣延长金额。当我尝试在另一个字段上输出值只是为了检查它得到了什么,我一直得到0 strangley。我的代码如下:
// Part where I grab the value
Entity entity = (Entity)context.InputParameters["Target"];
Money extenedAmount = (Money)entity["baseamount"];
//Create new line
Entity oppportunity_product = new Entity("opportunityproduct");
oppportunity_product["manualdiscountamount"] = extenedAmount;
service.Create(oppportunity_product);
甚至可以获取金额吗?如果有人可以帮助我,我真的很感激。谢谢你的支持。
答案 0 :(得分:2)
创建后,您想要添加帖子图像。然后引用帖子图像而不是目标。
if (context.PostEntityImages.Contains("PostImage") &&
context.PostEntityImages["PostImage"] is Entity)
{
postMessageImage = (Entity)context.PostEntityImages["PostImage"];
}
else
{
throw new Exception("No Post Image Entity in Plugin Context for Message");
}