我在表单中有一个Customer类型字段,其架构名称为myorg_customer
。 (请注意,不是CRM附带的架构名称为customerid
的现成客户字段。)
我正在使用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);
但是在这样做之后,页面会更改以打开“创建”表单,但是我收到一条错误消息“#34;发生错误"。日志文件如下:
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>
通过设置customerid
,customeridname
和customeridtype
参数,在表单上设置开箱即用的客户字段时,同样的方法也适用。
任何见解?
谢谢,
Anindit
答案 0 :(得分:1)
您需要添加myorg_customername
,myorg_customertype
和myorg_customer_id
作为表单参数。您的错误消息是Crm说不允许表单参数的坏方法...
这些是guidelines from the Documentation:
在a上设置查找值时,以下准则适用 使用查询字符串参数形式:
对于简单查找,您必须设置要在查找中显示的值和文本。使用带有属性名称的后缀“name”来设置文本的值。
不要使用任何其他参数。
对于客户和所有者查找,您必须按照为简单查找设置它们的方式设置值和名称。此外,您必须使用后缀“type”来指定实体的类型。允许的值包括account,contact,systemuser和team。
- 醇>
您无法设置部分列表或查找的值。
我确保您使用的是实际的客户字段类型,而不仅仅是联系参考。我还要确保它不是关于或者是一个关于它的人。如果是,您需要定义与CRM正在寻找的参数值不匹配的参数值(例如,添加下划线myorg_customer_name
,myorg_customer_type
和{{1}}),然后编写代码在onload上读取这些参数并填充正确的字段。