[英]Get data from parent form in a popup CRM Dynamics 2015
我在實體表單上有一個按鈕,用於打開CRM模式。 我需要從該模式下的IFrame生成數據,我嘗試了很多方法。 我在IFrame html中包含了ClientGlobalContext.js.aspx參考,我也嘗試了
$.each(parent.window.frames, function (i, val) {
if (parent.window.frames[i].Xrm.Page.data.entity != null) {
});
window.parent.Xrm.Page ...
window.top.opener.frames[0].Xrm.Page... //here window top opener is null
window.parent.opener.crmForm.all.name.DataValue //window parent opener is null
還有其他選擇嗎?
您可以顯示模態是如何創建的嗎? 這是在頁面或類似window.showModalDialog(已棄用!)之類的頁面中插入框架的jQuery-UI樣式模式嗎?
假設對話框位於同一“頂部”框架中的某處,這就是我的處理方式。 假設我在“帳戶”記錄上有一個表單腳本。 在我的onload函數中,我配置了ISV_Account_Form_onload:
// Return some data from the form
function ISV_GetAccountData(){
return {
Name: Xrm.Page.getAttribute('name').getValue()
};
}
// Runs onload
function ISV_Account_Form_onload{
// Define my function on the top window
top.ISV_GetAccountData = ISV_GetAccountData;
}
然后在我的內聯框架中,我將調用:
var accountData = top.ISV_GetAccountData();
這也可以從彈出窗口中進行:
var accountData = top.opener.top.ISV_GetAccountData();
為簡便起見,我排除了在窗體卸載時清理函數,確保在調用之前定義了函數等問題。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.