Can You Cancel This CRM Contract

An end user contacted me today with an unusual error.  She asked if I could cancel a Contract in CRM because the system was not letting her do it.  This was the error I received when I opened the contract, selected Actions and selected Cancel Contract from the drop-down list:


That was an interesting error.  I knew it had something to do with the pricing related to the Contract or Contract Line(s) but all the pricing looking valid to me.  My next step was to check server Application log for additional information.  Following is the related error message from the application log:

Event Type:    Warning
Event Source:    ASP.NET 2.0.50727.0
Event Category:    Web Event
Event ID:    1309
Date:        8/25/2010
Time:        11:39:23 AM
User:        N/A
Computer:    CRM Server
Event code: 3005
Event message: An unhandled exception has occurred.
Event time: 8/25/2010 11:39:23 AM
Event time (UTC): 8/25/2010 3:39:23 PM
Event ID: c70810efb70e4e2abea903d614b106d3
Event sequence: 116598
Event occurrence: 56
Event detail code: 0
Thread information:
    Thread ID: 7
    Thread account name: NT AUTHORITYNETWORK SERVICE
    Is impersonating: False
    Stack trace:    at System.RuntimeMethodHandle._InvokeMethodFast(Object target, Object[] arguments, SignatureStruct& sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.RuntimeMethodHandle.InvokeMethodFast(Object target, Object[] arguments, Signature sig, MethodAttributes methodAttributes, RuntimeTypeHandle typeOwner)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture, Boolean skipVisibilityChecks)
   at System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invokeAttr, Binder binder, Object[] parameters, CultureInfo culture)
   at System.Web.Services.Protocols.LogicalMethodInfo.Invoke(Object target, Object[] values)
   at Microsoft.Crm.Extensibility.InternalOperationPlugin.Execute(IPluginExecutionContext context)
   at Microsoft.Crm.Extensibility.PluginStep.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.Pipeline.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.MessageProcessor.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.InternalMessageDispatcher.Execute(PipelineExecutionContext context)
   at Microsoft.Crm.Extensibility.ExternalMessageDispatcher.Execute(String messageName, Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, PropertyBag fields, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
   at Microsoft.Crm.Sdk.RequestBase.Process(Int32 primaryObjectTypeCode, Int32 secondaryObjectTypeCode, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
   at Microsoft.Crm.Sdk.RequestBase.Process(CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
   at Microsoft.Crm.Sdk.CrmServiceInternal.Execute(RequestBase request, CorrelationToken correlationToken, CallerOriginToken originToken, UserAuth userAuth, Guid callerId)
   at Microsoft.Crm.Sdk.InProcessCrmService.Execute(Object request)
   at Microsoft.Crm.Application.Platform.ServiceCommands.PlatformCommand.ExecuteInternal()
   at Microsoft.Crm.Application.Platform.ServiceCommands.UpdateCommand.Execute()
   at Microsoft.Crm.Application.Platform.EntityProxy.Update(Boolean performDuplicateCheck)
   at Microsoft.Crm.Application.Platform.ContractDetail.Update(Boolean performDuplicateCheck)
   at Microsoft.Crm.Application.Platform.EntityProxy.UpdateAndRetrieve(String columnSet)
   at Microsoft.Crm.Application.Platform.EntityProxy.UpdateAndRetrieve()
   at Microsoft.Crm.Web.CS.ContractDetailPage.cancel(Object sender, DataEventArgs e)
   at Microsoft.Crm.Application.Forms.DataEventProcessor.Raise(FormEventId eventId, FormState state, IUser user, String objectId, Entity entity)
   at Microsoft.Crm.Application.Forms.AppForm.RaiseDataEvent(FormEventId eventId)
   at Microsoft.Crm.Application.Forms.EndUserForm.Initialize(Entity entity)
   at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity, String formType)
   at Microsoft.Crm.Application.Forms.CustomizableForm.Execute(Entity entity)
   at Microsoft.Crm.Web.CS.ContractDetailPage.ConfigureForm()
   at Microsoft.Crm.Application.Controls.AppUIPage.OnPreRender(EventArgs e)
   at System.Web.UI.Control.PreRenderRecursiveInternal()
   at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)


I didn’t learn a lot from that so I decided use the CRM Diag Tool, turn Dev Errors on, reproduce the error and that did the trick.  The detailed error was :

Error Description:

A validation error occurred. The value of ‘totalprice’ on record of type ‘contract’ is outside the valid range.

At that point, all I had to do was try and understand why, what looked to be a valid total price on the Contract, was not.  I decided to have a closer look at the Contract Lines and found the culprit.  A Contract Line was $.01 more than the total value of the Contract.  How that happened, I don’t know and since this was the first time I’d seen this type of error, I decided to move forward and get the issue resolved.

After exploring a few options, I determined that I was not going to be successful using standard methods like leveraging workflows to update or cancel the contract, etc. so I decided to go the unsupported route on this one.  I don’t recommend this and I generally do everything to avoid it but since this was a very odd data anomaly, it appeared to be my best option. 

To correct the issue, I completed a backup of the database and then ran a script on the contract and updated the totalprice and netprice field to match the value of the Contract Line.  I could have chosen to match the Contract Line to the Contract as it would most likely have had the same effect.  To complete the fix, I opened the Contract record from CRM, selected Actions, Cancel Contract and this time the Cancel request worked. 

Hopefully none of you will run into this odd issue, but if you do, you’ll have a potential solution that you can try.  Of course, you can always open a Microsoft Support case as well and if it is deemed to be an application issue, there will be no charge for the Case.

Technorati Tags:  ,,  ,   

Windows Live Tags: Cancel,Contract,error,Contract Line,Microsoft Support Case


  1. I am facing the same issue. Any updates was this issue resolved in any of the roll-ups? I am facing this particular issue on the netprice value instead of totalprice.

    1. Since it was a data anamoly, I don’t believe it will be addressed in any update rollups. If you are experiencing this frequently, then I suggest opening a case with Microsoft Support.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s