I am loading a Microsoft CRM 4.0 window from an Intranet page using window.open(...).
When the window closes, I need it to programmatically press a button on the page that opened it. I can do this from my own form by getting the button (whose name is passed in the querystring) and executing its click method in JavaScript.
I thought I could try opening my own window with an iframe containing the CRM page as I do with other web-based systems on our Intranet. In the page I can then click the button in the onunload event of the page. However, although this works for most of our systems, with CRM I get two problems.
Is there a solution for this?
You could do something like use a basic javascript window.opener call.
Page 1 opens a CRM window. In the OnSave of that CRM window you call something like this:
if(window.opener.DoSomeFunction != null)
{
window.opener.DoSomeFunction;
}
Where DoSomeFunction() is a defined javascript function in Page 1. The you could use a PageMethod or a __doPostBack() call. I haven't had a chance to try this inside MS CRM but in theory this approach might work.
Reference on javascript window.opener: