Well I have to admit, we missed this one.  By Design, Internet Explorer does not allow you to access the "Dialog's opener" via window.opener.  The only supported work around is to pass a reference to the opening window via Dialog Arguments.  The problem is that in v1.0 and v1.2 of Microsoft CRM we always pass NULL in the Dialog's Arguments property.  This has been fixed in CRM 2005, but I wanted to publish a "unsupported" hack that you can do to make this work in v1.x.

Warning: This change is unsupported and will be stomped on during a v1.0 to v1.2 or v2.0 upgrade.  The good news is that since the hack I am showing you is very similar to our CRM 2005 fix, the code you write in your files that depend on this should work just fine in both v1.x (with hack) and in CRM 2005 (no promises of course).

Here are the steps:

1.) Apply the "hack" to the openIsvWin() method in /wwwroot/_common/scripts/global.js - The change needs to happen around line number 152.  Be sure to back this file up before making any changes... upgrades/hotfixes/etc. will write over any changes that you make to this file.

Old Code:

  case "1": window.showModalDialog(sPath, null, sParams);  break;
  case "2": window.showModelessDialog(sPath, null, sParams); break;

New Code:

  case "1": window.showModalDialog(sPath, window, sParams);  break;
  case "2": window.showModelessDialog(sPath, window, sParams); break;

2.) Add a button, menu item, etc. to ISV.Config and set the WinMode property to either 1 or 2 (for dialogs)

3.) In your dialog add code that accesses the "window.opener" - Example:

 // Access to the parent Window using this method -SHOULD- still work in CRM 2005
 // Although the parent page's HTML / Structure will change.

 function window.onload()
 {
       alert(window.dialogArguments.document.body.innerHTML);
 }

4.) Have fun working with the window opener.  This is very useful if you need to access form variables, etc. on the parent window of your modal dialog that will perform an action.


Aaron Elder
Microsoft Customer Relationship Management
Core Application Development Team

Disclaimer:
This posting is provided "AS IS" with no warranties, and confers no rights.