Dynamics 365 V9 web 资源获取上下文

Dynamics 365 V9 web resource get context

我使用 this article 在潜在客户表单中单击按钮时打开弹出窗口 window。在这个弹窗window的一个按钮的onclick事件中,我想设置父窗体中某个字段的值。我如何在 V9 中执行此操作,因为 xrm.page 已被弃用?我想知道

的等价物
window.parent.Xrm.Page.getAttribute("subject")

以上行在前导表单中的值为 null。

编辑:在 Arun 发表的 link 评论中,写着 "although Xrm.Page is deprecated, parent.Xrm.Page will continue to work in case of HTML web resources embedded in forms as this is the only way to access the form context from the HTML web resource."

由于我打开的是弹出窗口 window,它没有嵌入到表单中,所以我无法使用 parent.Xrm.page。因此,无法使用弹出窗口中的脚本在父表单中设置值 window?

您可以使用 window.opener 来完成。

window.opener.Xrm.Page.getAttribute('subject').getValue();