我有一個表單中的客戶類型字段,其模式名稱爲:myorg_customer
。 (請注意,這是不是一個徹頭徹尾的現成客戶現場使用隨CRM架構名稱customerid
。)Dynamics CRM 2016 - 使用表單參數設置自定義客戶查詢
我打開一個新的創建形式,用javascript如下:
var customer = [
{
id: "571A6CE5-3EBC-4672-A164-D8F9654D4FCF",
name: "TestContact"
}
];
parameters['myorg_customer'] = customer[0].id;
parameters['myorg_customername'] = customer[0].name;
parameters['myorg_customertype'] = "contact" // since my customer is a contact instead of an account.
parent.Xrm.Utility.openEntityForm("myorg_myentity", null, parameters);
但這樣做後,頁面更改爲打開創建窗體,但我收到一條錯誤消息,指出「發生錯誤」。日誌文件如下:通過設置customerid
,customeridname
,並且customeridtype
參數設置窗體上一個不折不扣的現成客戶現場時
Unhandled Exception: System.ServiceModel.FaultException`1[[Microsoft.Xrm.Sdk.OrganizationServiceFault, Microsoft.Xrm.Sdk, Version=8.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35]]: System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #89B46272Detail:
<OrganizationServiceFault xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/xrm/2011/Contracts">
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<KeyValuePairOfstringanyType>
<d2p1:key>CallStack</d2p1:key>
<d2p1:value xmlns:d4p1="http://www.w3.org/2001/XMLSchema" i:type="d4p1:string"> at System.Web.UI.Page.HandleError(Exception e)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
at System.Web.UI.Page.ProcessRequest()
at System.Web.UI.Page.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)</d2p1:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>System.Web.HttpUnhandledException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #89B46272</Message>
<Timestamp>2017-01-03T13:41:22.8457002Z</Timestamp>
<InnerFault>
<ErrorCode>-2147220970</ErrorCode>
<ErrorDetails xmlns:d3p1="http://schemas.datacontract.org/2004/07/System.Collections.Generic">
<KeyValuePairOfstringanyType>
<d3p1:key>CallStack</d3p1:key>
<d3p1:value xmlns:d5p1="http://www.w3.org/2001/XMLSchema" i:type="d5p1:string"> at Microsoft.Crm.Application.ParameterFilter.ValidateParameter(HttpRequest request, ArrayList parameterCollection, String key, String value, ParameterSources source, EntityType pageEntityType, FormAdditionalAllowedParameters additionalAllowedParameters)
at Microsoft.Crm.Application.ParameterFilter.ValidateParameters(Page page, EntityType pageEntityType, Boolean alwaysEnableParameterChecking, FormAdditionalAllowedParameters formAdditionalAllowedParametersTemp)
at Microsoft.Crm.Application.Controls.AppPage.ValidatePageParameters()
at Microsoft.Crm.Application.Controls.AppPage.OnInit(EventArgs e)
at System.Web.UI.Control.InitRecursive(Control namingContainer)
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)</d3p1:value>
</KeyValuePairOfstringanyType>
</ErrorDetails>
<Message>System.InvalidOperationException: Microsoft Dynamics CRM has experienced an error. Reference number for administrators or support: #46259303</Message>
<Timestamp>2017-01-03T13:41:22.8457002Z</Timestamp>
<InnerFault i:nil="true" />
<TraceText i:nil="true" />
</InnerFault>
<TraceText i:nil="true" />
</OrganizationServiceFault>
同樣的方法工作。
任何見解?
謝謝
Anindit
代碼對我來說很好。 2條建議。 1)看看[手動創建URL](https://msdn.microsoft.com/en-us/library/gg334375.aspx#BKMK_ExampleWindowOpen)有什麼區別。 2)如果您在本地,則打開跟蹤並查看跟蹤輸出是否顯示可能有助於排除故障的任何信息。 – Polshgiant