Cannot use Xrm.Page.getControl to get iframe

After upgrading from dynamic-crm 2011 to dynamic-crm 2013, I had problems updating the iframe.

Earlier in sdk, Microsoft should get the / iframe control using "Xrm.Page.getControl ()" or other messages to say "Xrm.page.ui.controls.get ()" below, these are the errors I get. enter image description here

I found a job, but I am worried that it is not supported. I use Jquery for the first time to get an iframe, which is a post, since it is no longer its own window. Then I search for the name / id of my web resource / iframe.

$("#contentIFrame0").contents().find("#WebResource_PowerTools")[0].contentWindow.location.reload(true);

It works and now I am using. My question is: does anyone know what happened to Xrm.Page.getControl()or Xrm.page.ui.controls?

+4
source share
4 answers

There is a spelling error in the debugger. It should be Xrm.Page.ui.controlsinstead Xrm.Page.ui.control.

Below code should work for you.

Xrm.Page.ui.controls.get("WebResource_PowerTools");
+1
source

The problem is what you are trying to achieve and use XRM in iFrame. But the Xrm functions are in the window, so just follow these steps:

window.parent.Xrm.Page...
+1
source

self.parent.Page.ui.controls.get("WebResource_PowerTools");

0
source
Xrm.Page.ui.controls.get('id_iframe').getObject().onload= function() {
    var element = Xrm.Page.ui.controls.get('id_iframe').getObject().contentWindow.document.getElementById('id_element_inside_iframe');
    console.log(element);
};
  • Xrm.Page.ui.controls.get ('id_iframe'). getObject (): returns an iFrame HTML object
0
source

All Articles