帐户表单上有一个子网格,允许您快速创建联系人(联系人快速创建表单)。快速创建表单的OnLoad,我需要能够识别哪些子网格触发快速创建表单,因为表单上有许多子网格。
我目前有如下的javascript,触发联系人快速创建表单onLoad:
function contactQuickCreateFormOnLoad(context)
{
debugger;
//alert("hello world");
var formContext = context.getFormContext();
var control = formContext.getControl();
}
我接近这个正确,因为我需要得到也许触发快速创建表单加载的子网格的名称?这是正确的范围吗?
我问这个问题是因为上面的代码似乎只允许我看到快速创建表单上的实际控件。我找不到任何与触发此事件的子网格相关的元数据。有什么建议就太好了。
致意。
-
据我所知,您无法获取快速创建表单打开的子网格属性,但是您可以获取快速创建表单打开的父实体属性。
-
你可以做的是自定义按钮,添加一个Js来打开你的快速创建,在那里你可以传递参数。
-
这些参数值你可以从
快速创建var entityFormOptions = {}; entityFormOptions["entityName"] = "contact"; entityFormOptions["useQuickCreateForm"] = true; // Set default values for the Contact form var formParameters = {}; formParameters["firstname"] = "Sample"; formParameters["lastname"] = "Contact"; formParameters["fullname"] = "Sample Contact"; formParameters["emailaddress1"] = "contact@adventure-works.com"; formParameters["jobtitle"] = "Sr. Marketing Manager"; formParameters["donotemail"] = "1"; formParameters["description"] = "Default values for this record were set programmatically."; // Set lookup column formParameters["preferredsystemuserid"] = "3493e403-fc0c-eb11-a813-002248e258e0"; // ID of the user. formParameters["preferredsystemuseridname"] = " Admin user"; // Name of the user. formParameters["preferredsystemuseridtype"] = "systemuser"; // Table name. // End of set lookup column // Open the form. Xrm.Navigation.openForm(entityFormOptions, formParameters).then( function (success) { console.log(success); }, function (error) { console.log(error); });