我正在尝试使用 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。
我会发布错误消息的图片,但我还没有这样做的声誉。