我的CRM 2011插件存在问题。SaveChanges CRM 2011插件未处理的异常
var QuoteProduct = crm.QuoteDetailSet.Where(c
=> c.QuoteDetailId == QPID).First();
double Tax = (double)(
(QuoteProduct.BaseAmount
- QuoteProduct.ManualDiscountAmount.GetValueOrDefault()
- QuoteProduct.VolumeDiscountAmount.GetValueOrDefault())/20);
QuoteProduct.Attributes["tax"] = Tax;
crm.UpdateObject(QuoteProduct);
crm.SaveChanges();
保存更改行发生错误。错误详情如下。
Microsoft.Xrm.Sdk.SaveChangesException了未处理由用户代码
消息=处理此请求时发生错误。
源= Microsoft.Xrm.Sdk
堆栈跟踪:
在Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChanges(SaveChangesOptions选项)用C
在Plugin.TaxCreator(IOrganizationService服务,的Guid QPID):\用户\ mycrm \ Desktop \ BMSD.QuoteProduct.Tax \ BMSD.QuoteProduct.Tax \ BMSD.QuoteProduct.Tax.cs:line 62
at C:\ Users \ mycrm \ Desktop \ BMSD.QuoteProduct中的Plugin.Execute(IServiceProvider serviceProvider)。 Tax \ BMSD.QuoteProduct.Tax \ BMSD.QuoteProduct.Tax.cs:line 38
at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
at Microsoft.C rm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext上下文)
InnerException:System.ServiceModel.FaultException Message = System.InvalidCastException:Microsoft Dynamics CRM遇到错误。在
在Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest请求,CorrelationToken correlationToken,CallerOriginToken callerOriginToken,WebServiceType的serviceType)
:针对管理员或支持参考号:#BE061894
源= Microsoft.Crm.Extensibility
堆栈跟踪Microsoft.Crm.Extensibility.InprocessServiceProxy.ExecuteCore(OrganizationRequest请求)
在Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest请求)
在Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChange(OrganizationRequest请求,IList的`1结果)
的InnerException:
谢谢谢尔盖。由于我是这些科目的新手,所以我的问题可能看起来很愚蠢! – 2013-03-10 08:54:56
@PaymanBiukaghazadeh不,它没有。你可能会考虑改进你的问题的唯一方法是格式化。我这次为你做了这件事,但如果你精确地设置问题的话,你可能会在未来得到更好的回应。快乐的编码! – 2013-03-10 09:32:14