当前位置: 首页 > 知识库问答 >
问题:

Dynamics 365 CRM:突发JS错误

骆昊阳
2023-03-14

使用Dynamics 365版本1612(8.2.2.112)在premises。在Quote表单上,我修改了Activate Quote调用的操作,以创建自定义实体(交易)记录,然后导航到新创建的记录。直到两周前,这在所有浏览器中都运行得很好。现在,它在IE中不起作用(客户端优先--但在Chrome、Firefox和Edge中起作用),我得到的只是一些通用的JSON错误。“无效的JSON。在JSON内容中无法识别令牌。”

>

  • 完整的响应体粘贴在下面。

    完整的JSON粘贴在下面

    这是调用操作(new_SubmitQuote)来创建new Deal实体记录,然后导航到该新记录的JS。

    n.xxx_submitQuote=function(n){
        r.showXrmProgressIndicator("Submitting, please wait...");
         u.executeBoundAction("quotes",n,"new_SubmitQuote").then(function(n){
            t.Utility.openEntityForm("sut_deal",n.sut_dealid,null,null)}).catch(r.logError).then(function(){
                r.closeXrmProgressIndicator()
            })
        }
    

    JSON

    {  
       "@odata.context":"https://xxx.xxx.com/CRM/api/data/v8.2/$metadata#quotes/$entity",
       "@odata.etag":"W/\"54328330\"",
       "new_spread":95903.0200,
       "new_amount10percent":310777.7900,
       "new_revenue10":777.79,
       "new_paymentcount_date":"2018-06-19T00:53:29Z",
       "_pricelevelid_value":"bfa9dc95-dbcd-e611-80d7-000d3a01f3fc",
       "exchangerate":1.0000000000,
       "totaldiscountamount":0.0000,
       "name":"100026",
       "totallineitemamount":0.0000,
       "_transactioncurrencyid_value":"9107a2c3-bab1-e611-80d2-000d3a01f3fc",
       "_owninguser_value":"a9c113ac-d532-e811-8119-000d3a02dfdb",
       "totalamount":0.0000,
       "_ownerid_value":"a9c113ac-d532-e811-8119-000d3a02dfdb",
       "versionnumber":54328330,
       "quoteid":"04224af9-dd70-e811-8123-000d3a02dfdb",
       "totallineitemdiscountamount":0.0000,
       "timezoneruleversionnumber":0,
       "totalamountlessfreight_base":0.0000,
       "statuscode":1,
       "createdon":"2018-06-15T20:52:12Z",
       "totaltax_base":0.0000,
       "totallineitemamount_base":0.0000,
       "totalamount_base":0.0000,
       "modifiedon":"2018-06-15T20:53:23Z",
       "totaltax":0.0000,
       "totaldiscountamount_base":0.0000,
       "quotenumber":"QUO-38015-F3D2B8",
       "_modifiedby_value":"a9c113ac-d532-e811-8119-000d3a02dfdb",
       "revisionnumber":0,
       "_createdby_value":"a9c113ac-d532-e811-8119-000d3a02dfdb",
       "pricingerrorcode":0,
       "totallineitemdiscountamount_base":0.0000,
       "statecode":0,
       "_owningbusinessunit_value":"1a1ad33f-bab1-e611-80d2-000d3a01f3fc",
       "willcall":false,
       "_customerid_value":"7a60bf77-dd70-e811-8123-000d3a02dfdb",
       "billto_addressid":null,
       "discountpercentage":null,
       "shipto_composite":null,
       "onholdtime":null,
       "billto_line2":null,
       "closedon":null,
       "paymenttermscode":null,
       "freightamount_base":null,
       "_modifiedonbehalfby_value":null,
       "freightamount":null,
       "billto_city":null,
       "_campaignid_value":null,
       "shipto_line1":null,
       "_contactid_value":null,
       "requestdeliveryby":null,
       "freighttermscode":null,
       "billto_stateorprovince":null,
       "effectivefrom":null,
       "shipto_line3":null,
       "discountamount_base":null,
       "billto_line3":null,
       "shipto_telephone":null,
       "shipto_contactname":null,
       "expireson":null,
       "shipto_freighttermscode":null,
       "shipto_line2":null,
       "shipto_addressid":null,
       "_opportunityid_value":null,
       "shipto_fax":null,
       "shipto_country":null,
       "shipto_stateorprovince":null,
       "billto_composite":null,
       "billto_line1":null,
       "billto_contactname":null,
       "billto_telephone":null,
       "shipto_city":null,
       "_owningteam_value":null,
       "discountamount":null,
       "description":null,
       "shippingmethodcode":null,
       "processid":null,
       "_accountid_value":null,
       "_slainvokedid_value":null,
       "stageid":null,
       "traversedpath":null,
       "billto_postalcode":null,
       "utcconversiontimezonecode":null,
       "shipto_name":null,
       "overriddencreatedon":null,
       "billto_fax":null,
       "effectiveto":null,
       "importsequencenumber":null,
       "_new_createdby_value":null,
       "shipto_postalcode":null,
       "lastonholdtime":null,
       "billto_name":null,
       "_slaid_value":null,
       "_createdonbehalfby_value":null,
       "billto_country":null,
    }

    误差

        {
        "error":{
        "code":"","message":"Invalid JSON. A token was not recognized in the JSON content.",
        "innererror":{
        "message":"Invalid JSON. A token was not recognized in the JSON content.","type":"Microsoft.Crm.CrmHttpException","stacktrace":"
        at Microsoft.Crm.Extensibility.OData.CrmODataUtilities.ValidateInputParameters(ModelStateDictionary controllerModelState)
        at Microsoft.Crm.Extensibility.OData.ActionController.PostBoundAction(String entityName, String key, String operationName, ODataUntypedActionParameters parameters)
        at lambda_method(Closure , Object , Object[] )
        at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ActionExecutor.<>c__DisplayClass10.<GetExecutor>b__9(Object instance, Object[] methodParameters)
        at System.Web.Http.Controllers.ReflectedHttpActionDescriptor.ExecuteAsync(HttpControllerContext controllerContext, IDictionary`2 arguments, CancellationToken cancellationToken)
        --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
        at System.Web.Http.Controllers.ApiControllerActionInvoker.<InvokeActionAsyncCore>d__0.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
        at System.Web.Http.Controllers.ActionFilterResult. <ExecuteAsync>d__2.MoveNext()
        --- End of stack trace from previous location where exception was thrown ---
        at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw()
        at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification(Task task)
        at System.Web.Http.Dispatcher.HttpControllerDispatcher.<SendAsync>d__1.MoveNext()"
        }
        }
        }
  • 共有1个答案

    穆建元
    2023-03-14

    也许是因为您使用的JSpromise可能不被引用Mozilla.org caniuse.com的某些版本的IE支持,但是您可以通过尝试使用回调参数打开实体表单的常规操作调用来解决这个问题,请检查下面的示例,考虑更改API版本。

    function ExecuteAction(entitySet, entityId, actionName, Parameters, successCallBack, ErrorCallBack, isAsync) {
    debugger;
    var clientUrl = Xrm.Page.context.getClientUrl();
    var isAsync = isAsync || false;
    var result = {};
    entityId = entityId.replace('{', '').replace('}', '');
    var req = new XMLHttpRequest();
    req.open("POST", clientUrl + "/api/data/v8.1/" + entitySet + "(" + entityId + ")/Microsoft.Dynamics.CRM." + actionName, isAsync);
    req.setRequestHeader("Accept", "application/json");
    req.setRequestHeader("Content-Type", "application/json; charset=utf-8");
    req.setRequestHeader("OData-MaxVersion", "4.0");
    req.setRequestHeader("OData-Version", "4.0");
    req.onreadystatechange = function () {
        if (this.readyState == 4 /* complete */) {
            req.onreadystatechange = null;
            var s = this.status;
            if (s >= 200 && s < 300) { //success 
                result.status = true;
                result.data = this.response;
                if (successCallBack) 
                    successCallBack();
    
            } else if (s >= 400 && s < 500) { // client error 
                result.status = false;
                console.log("Client error");
                result.error = JSON.parse(this.response).error;
                console.log(result.error);
                console.log(result.error.message);
                if (ErrorCallBack)
                    ErrorCallBack(result);
    
    
            } else if (s >= 500) { //server error 
                result.status = false;
                console.log("Server error");
                result.error = JSON.parse(this.response).error;
                console.log(result.error);
                console.log(result.error.message);
                if (ErrorCallBack) 
                    ErrorCallBack(result);
    
            }
    
    if (Parameters == "" || Parameters == null) {
        req.send();
    } else {
        req.send(JSON.stringify(Parameters));
    }
    
    return result;
    

    }

     类似资料:
    • 当我的抛出错误时,就会发生这种情况。 说明:我有两个事件,具有相同的,不能解决这个问题并抛出错误,因为。 我的问题是,是否有任何最佳实践来处理错误,这样其他事件就可以很好地工作,而无需等待修复此单个事件?或者有什么解决办法可以解决这个问题?

    • 我的PhpStom安装突出显示了我的JS文件的语法()。它无法识别项目中其他JS文件中的函数。PHP端没问题。 这些是我看到的一些错误。如何将 JS 语法检查器重置为默认值?

    • 我试了好几个小时想找到解决办法,但没有找到。我的问题是,当我建立我的梯度时,我得到了两个错误。我试图在我的Android应用程序中查看这个解决方案依赖冲突错误,该应用程序进行了Android测试,但仍然无法解决这个问题。 这是我的建筑。格雷德尔 我该怎么解决这个?

    • 本文向大家介绍快速解决js开发下拉框中blur与click冲突,包括了快速解决js开发下拉框中blur与click冲突的使用技巧和注意事项,需要的朋友参考一下 在开发中我们会经常遇到blur和click冲突的情况。下面叙述了开发中常遇到的“下拉框”的问题,并提供了两种解决方案。 一、blur和click事件简述 blur事件:当元素失去焦点时触发blur事件;其为表单事件,blur和focus事件

    • 我正在尝试向使用Apollo的GraphQL服务器发送突变查询。 然而,我只看到实现这一点的唯一方法是使用突变组件。https://www.apollographql.com/docs/react/essentials/mutations/#the-突变成分 有没有一种简单的方法可以发送这样的突变? 从“graphql标记”导入gql;