I have a problem in my CRM 2011 plugin.
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();
The error occurs on the save changes line. The error details are as follows.
Microsoft.Xrm.Sdk.SaveChangesException was unhandled by user code
Message=An error occured while processing this request.
Source=Microsoft.Xrm.Sdk
StackTrace:
at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChanges(SaveChangesOptions options)
at Plugin.TaxCreator(IOrganizationService service, Guid QPID) in C:\Users\mycrm\Desktop\BMSD.QuoteProduct.Tax\BMSD.QuoteProduct.Tax\BMSD.QuoteProduct.Tax.cs:line 62
at Plugin.Execute(IServiceProvider serviceProvider) in C:\Users\mycrm\Desktop\BMSD.QuoteProduct.Tax\BMSD.QuoteProduct.Tax\BMSD.QuoteProduct.Tax.cs:line 38
at Microsoft.Crm.Extensibility.V5PluginProxyStep.ExecuteInternal(PipelineExecutionContext context)
at Microsoft.Crm.Extensibility.VersionedPluginProxyStepBase.Execute(PipelineExecutionContext context)
InnerException: System.ServiceModel.FaultException Message=System.InvalidCastException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #BE061894
Source=Microsoft.Crm.Extensibility
StackTrace:
at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, CorrelationToken correlationToken, CallerOriginToken callerOriginToken, WebServiceType serviceType)
at Microsoft.Crm.Extensibility.InprocessServiceProxy.ExecuteCore(OrganizationRequest request)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.Execute(OrganizationRequest request)
at Microsoft.Xrm.Sdk.Client.OrganizationServiceContext.SaveChange(OrganizationRequest request, IList`1 results)
InnerException: