Dynamics 365 V9 web resource get context
Asked Answered
M

1

0

I used this article to open a popup window when clicking on a button in the Lead form. In the onclick event of a button in this popup window, I want to set the value of a field in the parent form. How can I do this in V9, since xrm.page is deprecated? I would like to know the equivalent of

window.parent.Xrm.Page.getAttribute("subject")

The line above has a value of null in the lead form.

EDIT: in the link posted by Arun in the comment down here, it is written that "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."

Since I am opening a popup window, that is not embedded in the form, I can't use parent.Xrm.page. So it is not possible to set a value in thet parent form with a script inside a popup window?

Milligan answered 23/7, 2018 at 19:1 Comment(3)
Possible duplicate of Dynamics 356 v9 - use executionContext.getFormContext() with HTML web resourceBibber
@Arun Vinoth the problem is that parent.xrm.page does not work: for example, window.parent.Xrm.Page.getAttribute("subject") gives null in the lead form.Milligan
Did you try window.opener ?Bibber
B
1

You can use window.opener to do it.

window.opener.Xrm.Page.getAttribute('subject').getValue();
Bibber answered 23/7, 2018 at 20:9 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.