繁体   English   中英

从弹出式CRM Dynamics 2015中的父表单获取数据

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM