【发布时间】:2015-01-03 19:59:25
【问题描述】:
我想创建一个新插件,以便在上次通话状态即将完成时创建新电话。
我正在编写下面的代码,但它会创建重复键异常...
if (entity.Attributes.ContainsKey("statuscode") &&
((OptionSetValue)entity.Attributes["statuscode"]).Value == 2)
{
if (preTarget != null)
{
try
{
var newCall = new Entity("phonecall");
newCall.Attributes.Add("to", preTarget.Attributes["to"]);
newCall.Attributes.Add("from", preTarget.Attributes["from"]);
newCall.Attributes.Add("subject", preTarget.Attributes["subject"]);
newCall.Attributes.Add("ownerid", preTarget.Attributes["ownerid"]);
organizationService.Create(newCall);
}
catch (Exception exception)
{
throw new InvalidPlugiExecutionException(exception.Message, exception);
}
}
}
【问题讨论】:
标签: dynamics-crm-2011 microsoft-dynamics