简体   繁体   English

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

[英]Get data from parent form in a popup CRM Dynamics 2015

I have a button on an entity form which opens a CRM modal. 我在实体表单上有一个按钮,用于打开CRM模式。 I need to get to form data from the IFrame inside that modal, I tried a lot of ways. 我需要从该模式下的IFrame生成数据,我尝试了很多方法。 I included ClientGlobalContext.js.aspx reference in the IFrame html, I also tried with 我在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

Are there any other options? 还有其他选择吗?

Can you show how your modal is created? 您可以显示模态是如何创建的吗? Is this a jQuery-UI style modal that inserts a frame in the page or something like window.showModalDialog (deprecated!)? 这是在页面或类似window.showModalDialog(已弃用!)之类的页面中插入框架的jQuery-UI样式模式吗?

Assuming a dialog somewhere in the same 'top' frame, this is how I handle this. 假设对话框位于同一“顶部”框架中的某处,这就是我的处理方式。 Let's say I have a form script on the Account record. 假设我在“帐户”记录上有一个表单脚本。 In my onload function I configured ISV_Account_Form_onload: 在我的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;
}

Then in my inline-frame I would call: 然后在我的内联框架中,我将调用:

var accountData = top.ISV_GetAccountData();

This can also work from a pop-up window: 这也可以从弹出窗口中进行:

var accountData = top.opener.top.ISV_GetAccountData();

For brevity I've excluded cleaning up the function when the form unloads, making sure the function is defined before calling, etc. 为简便起见,我排除了在窗体卸载时清理函数,确保在调用之前定义了函数等问题。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 Dynamics crm 365 快速创建表单获取父实体数据 - Dynamics crm 365 quick create form get parent entity data 如何在Dynamics CRM 2015中向表单添加按钮 - How to add a button to a form in Dynamics CRM 2015 如何将 CRM Dynamics 2015 表单数据(归档值)传递到具有 JavaScript 功能的 HTML 页面 - How to pass CRM Dynamics 2015 Form data(filed values) to an HTML page which has JavaScript functions Dynamics CRM 根据父表单/实体在新表单/实体中填充关系数据 - Dynamics CRM fill relationship data in new form/entity according to parent form/entity 我想使用纯Javascript从MS Dynamics CRM Online 2015添加/检索数据 - I want to add/retrieve data from MS Dynamics CRM Online 2015 using pure Javascript Dynamics CRM 2015:如何获得创建的Web资源按钮以引用添加到表单的Javascript库中的函数? - Dynamics CRM 2015: How do I get a Web Resource button I created to reference a function in a Javascript Library I added to the form? CRM Dynamics 2015 IFrame通信 - CRM Dynamics 2015 IFrame Communication 如何从Microsoft Dynamics CRM表单到html Web资源获取价值 - how to get value from microsoft dynamics crm form to html web resource Dynamics CRM 2015:在JScript中设置默认值而不会使表单变脏 - Dynamics CRM 2015: Set default value in JScript without making form dirty 我想在Dynamics 365 crm中从一种形式重定向到另一种形式 - I want to redirect from one form to another in dynamics 365 crm
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM