gpt4 book ai didi

javascript - Xrm.Utility.openEntityForm 设置查找字段

转载 作者:行者123 更新时间:2023-11-29 14:49:36 26 4
gpt4 key购买 nike

我正在尝试使用 Xrm.Utility.openEntityForm() 方法打开新的自定义实体表单并以编程方式设置实体查找字段。我正在关注 http://msdn.microsoft.com/en-us/library/gg334375.aspx 上的示例非常接近,但出现难以描述的错误。对于实际设置字段或可能查找错误日志的任何帮助,我们将不胜感激。

我正在关注的代码示例。

 function OpenNewContact() {

var parameters = {};

//Set the Parent Customer field value to “Contoso”.
parameters["parentcustomerid"] = "2878282E-94D6-E111-9B1D-00155D9D700B";
parameters["parentcustomeridname"] = "Contoso";
parameters["parentcustomeridtype"] = "account";

//Set the Address Type to “Primary”.
parameters["address1_addresstypecode"] = "3";

//Set text in the Description field.
parameters["description"] = "Default values for this record were set programmatically.";
//Set Do not allow E-mails to "Do Not Allow".
parameters["donotemail"] = "1";

// Open the window.
Xrm.Utility.openEntityForm("contact", null, parameters);
}

我创建的对我的自定义实体执行相同操作的函数如下:

function createNewService() {
var locationId = trimBrackets(Xrm.Page.data.entity.getId());

var primaryField = Xrm.Page.data.entity.getPrimaryAttributeValue();

var entityLogicalName = Xrm.Page.data.entity.getEntityName();

var parameters = {
cw_location: locationId,
cw_locationname: primaryField,
cw_locationtype: entityLogicalName
};

Xrm.Utility.openEntityForm("cw_service", null, parameters);

}

我打开表单的实体名称 work = cw_service(这不是问题,因为我可以使用 Xrm.Utility.openEntityForm("cw_service"); 打开空白表单)

我要设置的字段名称是 cw_location。

我会张贴错误消息的图片,但我还没有这样做的声誉。

最佳答案

对于简单查找,您必须设置要在查找中显示的值和文本。使用带有属性名称的后缀“名称”来设置文本的值。

不要使用任何其他参数进行简单查找

对于客户和所有者查找,您必须按照与简单查找相同的方式设置值和名称。此外,您必须使用后缀“type”来指定实体的类型。允许的值为帐户、联系人、系统用户和团队。

对于您的示例,我想这是一个简单的查找。所以,请尝试使用下面的代码:

var parameters = {
cw_location: locationId,
cw_locationname: primaryField
};

更多信息,请访问Set the value for lookup fields .

关于javascript - Xrm.Utility.openEntityForm 设置查找字段,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27697919/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com