[英]Pass data from html webresource window in MS Dynamics CRM
I need to pass data (an array of strings) from html webresource window to the form.我需要将数据(字符串数组)从 html webresource 窗口传递到表单。 Please note, window means window (it is NOT embedded in CRM form, is NOT a dialog, it is a window opened from the form).
请注意, window表示窗口(它不是嵌入在 CRM 表单中,不是对话框,它是从表单打开的窗口)。 I used Xrm.Utility.openWebResource.
我使用了 Xrm.Utility.openWebResource。 I need either to influence fields on the form or call a js function on the form.
我需要影响表单上的字段或在表单上调用 js 函数。 Any help is appreciated.
任何帮助表示赞赏。
PS "onunload" is ignored by Chrome PS“onunload”被 Chrome 忽略
Try something like this.尝试这样的事情。 Invoking a function from child in parent by
window.opener
is feasible.通过
window.opener
从父级中的子级调用函数是可行的。 Also you need Json library to serialize/deserialize so that objects can be sent between windows.您还需要 Json 库来序列化/反序列化,以便可以在窗口之间发送对象。
In CRM parent window:在 CRM 父窗口中:
function openWebResource() {
var popupWindow = Xrm.Utility.openWebResource(...);
}
function callFunction(myObjects) {
var entity = JSON.parse(myObjects);
if (entity) {
var value = new Array();
value[0] = new Object();
value[0].id = entity.Id;
value[0].Name = entity.Name;
// do your logic here
}
}
In popup window (web resource):在弹出窗口(网络资源)中:
function callParent() {
var entity = {};
entity.Id = 1;
entity.Name = “test”;
var arr = JSON.stringify(entity);
window.opener.callFunction(arr);
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.