我写了一个插件来更新销售订单上的一些数据,就在用户更新记录本身之后。根据某些日期是否更改,我想更新具有格式化日期的另一个字段。
我遇到了错误“给定的密钥不存在于字典中”所以我添加了一些跟踪以查看它确切地返回错误的位置。然后我发现跟踪从未写出来,所以我假设我写的代码永远不会被执行。事实确实如此,因为如果我这样做的话
public class SalesOrderPlugin : IPlugin
{
public void Execute(IServiceProvider serviceProvider)
{
}
}
我得到同样的错误:
Unhandled Exception: System.ServiceModel.FaultException`1
[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=5.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]:
Unexpected exception from plug-in (Execute): Iu.PreConsultants.Crm.SalesOrderPlugin:
System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147220956</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic" />
<Message>Unexpected exception from plug-in (Execute): Iu.PreConsultants.Crm.SalesOrderPlugin: System.Collections.Generic.KeyNotFoundException: The given key was not present in the dictionary.</Message>
<Timestamp>2012-02-21T07:09:48.471378Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText>
[Iu.PreConsultants.Crm: Iu.PreConsultants.Crm.SalesOrderPlugin]
[1486b5df-595c-e111-b7b0-46c950e6c8cd: Iu.PreConsultants.Crm.SalesOrderPlugin: Update of salesorder]
</TraceText>
</OrganizationServiceFault>
插件的设置:
在托管设置(沙盒)
上SalesOrder已被更改并具有一些自定义属性。
对此的任何帮助将不胜感激!
亲切的问候,
文森特
答案 0 :(得分:1)
好的,现在有效。似乎glosrob是正确的,并且CRM保留了缓存版本。我试图在SDK上注册工具的IPlugin实现上使用“更新”,但这还不够。我必须先更新程序集,然后,IPlugin实现也会更新。