Not able to access Xrm.page attributes

Dec 8, 2016 at 6:35 PM
Thanks for this js. I am trying the solution out, but facing difficulties in accessing xrm.page attributes. I am opening a web-resource through "Alert.showWebResource". Can you tell me how can I access Xrm.page inside this web resource ?? and How can I link the methods in the web resource to the "buttons" parameter in Alert.showWebResource??
Dec 8, 2016 at 7:26 PM
I tried
window.parent.Xrm, parent.Xrm, parent.parent.Xrm.. no luck
Dec 9, 2016 at 6:29 PM
I figured a way to access Xrm.Page, now the issue that is not resolved is

"How can I link the javascript functions in the web resource to the "buttons" parameter in Alert.showWebResource??"
Coordinator
Dec 9, 2016 at 7:38 PM
Hi, take a look at the documentation for getIFrameWindow and getCrmWindow. You can use Alert.getIFrameWindow().document.getElementById("...") from the Alert button functions to access the web resource window, and you can use parent.Alert.getCrmWindow().Xrm.Page to access Xrm.Page functions from inside the web resource.

Let me know if you have any difficulties.

https://alertjs.codeplex.com/documentation#Alert.getIFrameWindow

Regards,
Paul
Marked as answer by Liger on 2/6/2017 at 6:41 PM