Customer Engagement & Dynamics CRM Forum

Expand all | Collapse all

Error Winning Quote but Only When Opportunity Has A Specific Value

  • 1.  Error Winning Quote but Only When Opportunity Has A Specific Value

    Posted Mar 31, 2020 01:26 AM
    I have some custom JavaScript that will update quote line item fields, win the quote, and then win the opportunity. It works well except when the opportunity has a custom picklist field with a value of 961150000.
    The message sent to Dynamics is:
    {
      "Status": 4,
      "QuoteClose": {
        "subject": "Won Quote",
        "quoteid@odata.bind": "/quotes(ec3a757d-c272-ea11-a811-000d3a3b36cc)"
      }
    }

    The response is:
    {
        "error": {
            "code""0x80040265",
            "message""The Opportunity has Type = Quote and Category = Estimate and cannot be closed as Won.",
            "innererror": {
                "message""The Opportunity has Type = Quote and Category = Estimate and cannot be closed as Won.",
                "type""System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=9.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]",
                "stacktrace""   at Microsoft.Crm.Extensibility.OrganizationSdkServiceInternal.Execute(OrganizationRequest request, InvocationContext invocationContext, CallerOriginToken callerOriginToken, WebServiceType serviceType, Boolean checkAdminMode, ExecutionContext executionContext, Dictionary`2 optionalParameters)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataExecutionContext.Execute(OrganizationRequest request, ExecutionContext executionContext)\r\n   at Microsoft.Crm.Extensibility.OData.CrmODataServiceDataProvider.ExecuteOperation(CrmODataExecutionContext context, EdmOperation edmOperation, Dictionary`2 parameters, Dictionary`2 boundParameters)\r\n   at Microsoft.Crm.Extensibility.OData.ActionController.ProcessOperationRequest(String operationName, Dictionary`2 operationParameters, EntityReference entityReference, String boundEntityName, String boundEntityType)\r\n   at Microsoft.Crm.Extensibility.OData.ActionController.<>c__DisplayClass9_0.<PostUnboundAction>b__0()\r\n   at Microsoft.PowerApps.CoreFramework.ActivityLoggerExtensions.Execute[TResult](ILogger logger, EventId eventId, ActivityType activityType, Func`1 func, IEnumerable`1 additionalCustomProperties)\r\n   at Microsoft.Xrm.Telemetry.XrmTelemetryExtensions.Execute[TResult](ILogger logger, XrmTelemetryActivityType activityType, Func`1 func)\r\n   at lambda_method(Closure , Object , Object[] )\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)\r\n   at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Controllers.ActionFilterResult.<ExecuteAsync>d__2.MoveNext()\r\n--- End of stack trace from previous location where exception was thrown ---\r\n   at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()\r\n   at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)\r\n   at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
            }
        }
    }

    The error message makes me believe that the exception is being thrown by custom code associated with the picklist field.
    I have searched all of the custom code that I have access to.
    I have checked all of the dependencies of that particular field on the opportunity and disabled all of the processes associated with it.
    I have also disabled all plugin steps associated with both the quote and the opportunity but still I get the error. There are no plugin steps associated with the win message of a quote.
    I can use Postman to pass the win quote message and the quote is won without error.

    Has anyone seen a similar error?
    Can anyone suggest a different place to look for the code that would cause this error?

    #CustomerEngagement
    #Technical​​

    ------------------------------
    Scott Golightly
    Senior Developer
    JourneyTEAM
    Draper UT
    ------------------------------
    Academy - Online Interactive Learning from Experts


  • 2.  RE: Error Winning Quote but Only When Opportunity Has A Specific Value

    SILVER CONTRIBUTOR
    Posted Apr 01, 2020 09:16 AM
    Hi Scott,

    I have had customers create synchronous workflows that prevent an opportunity from closing unless a field is a certain value e.g. progressed to a certain stage. I know you said you disabled processes that showed dependencies on that field, but possibly revisit your synchronous Opportunity workflows.

    ------------------------------
    Scott Florance
    Business Applications Consultant
    KTL Solutions, Inc, Frederick MD
    ------------------------------

    Academy - Online Interactive Learning from Experts


  • 3.  RE: Error Winning Quote but Only When Opportunity Has A Specific Value

    Posted Apr 03, 2020 04:14 PM
    I thought I had disabled all of the workflows but apparently I either missed one or I forgot to publish or something else because after going back to the workflows we were able to find one that was causing the issue. That workflow is now disabled.

    ------------------------------
    Scott Golightly
    Senior Developer
    JourneyTEAM
    Draper UT
    ------------------------------

    Academy - Online Interactive Learning from Experts


If you've found this thread useful, dive deeper into User Group community content by role