![](/img/trans.png)
[英]Not able to get the record GUID in JavaScript code on save of Quick Create form
[英]Get Name of SubGrid on Account Form that Triggers Javascript on the Contact Quick Create Form OnLoad
帳戶表單上有一個子網格,可讓您快速創建聯系人(聯系人快速創建表單)。 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); });
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.