CRM 2011: reload parent window

Here’s how to reload the parent window with Dynamics CRM 2011:;

A word of explanation:

  • is the top window the current iframe. Remember that all code in onload CRM javascript runs in an iframe.
  • is the opener window
  • is used to make sure the whole page is refreshed and not an iframe
  • to reload

Pay attention, when opening the new window, to use a relative URL, or to be sure that the server name that you get when calling:


is the same as the one you are currently connected to. By that, I mean that it may happen that you connect to CRM server using localhost, the IP address or the fully qualified domain name, while getServerUrl will give you the base server name. As explained in the SDK:

The URL returned is the standard URL used to access the application. If you access the server locally using http://localhost or use an IP address instead of the actual name of the server, this will not be reflected in the value returned by this function. This means that if you are making web service calls or accessing web resources, the browser will apply security settings that apply to requests that cross domains.

So for example, using, and trying to reach the opener window from the child window, you will get an “access is denied” error. And you will see strange behavior when looking at the Xrm.Page object, with Xrm.Page.ui and being null if I am not mistaken.

By the way, from Update Rollup 8, the new way to open a popup window is to use this function:

Xrm.Utility.openEntityForm (or openWebResource)

Leave a Reply

Your email address will not be published. Required fields are marked *