Question

I have developed a silverlight application that is launched from a CRM form. The form has a field and in the OnChange event of the field, it calls window.open to open a HTML web resource:

window.open(serverUrl + "")...

The HTML web resource contains an iframe that embeds the silverlight control.

The silverlight control has a "Save Data" button that saves data back to the CRM form. This all works fine on my development PC, however, on other PC, the data are not saved back to CRM.

I put debugging messages and the Xrm object is null. In the silverlight code, I am accessing the Xrm object by:

HtmlPage.Window.Eval("document.parentWindow.opener.Xrm") as ScriptObject;

This works on my development PC but doesn't work on other PC, does anyone know why this is happening? Is this a permission or browser settings issue?

I also tried to run "document.parentWindow.opener.Xrm" in IE developer tool's script window on the other PC while the silverlight control is open, and i can see the DOM object ok??

Regards,

Jerry

Was it helpful?

Solution

It seems i have to get the Xrm object in silverlight directly for it to work in IE9:

window = HtmlPage.Window.Eval("document.parentWindow.opener.Xrm") as ScriptObject;

This doesn't seem to work in IE9, only works in IE8:

window = HtmlPage.Window.Eval("document.parentWindow.opener") as ScriptObject;

xrmObject = window.GetProperty("Xrm") as ScriptObject;

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top