November 18, 2010 21 Comments
For those of you trying to access a parent form’s Xrm.Page object in CRM 2011 you can use the following syntax.
From an IFrame HTML page
From a new window/dialog
An example of a new window being used is when you are viewing the Account Form and then choose to create a new Contact from the left hand navigation pane and then within the Contact Form you need to access the Account Form (parent).
Potential CRM 4 syntax to be replaced is as follows
window.opener.parent.document.crmForm window.opener.document.crmForm window.opener.parent.crmForm
<snippet> <crm4>window.opener.parent.document.|_|;</crm4> <crm5>window.top.opener.parent.|_|;</crm5> </snippet> <snippet> <crm4>window.opener.document.|_|;</crm4> <crm5>window.top.opener.parent.|_|;</crm5> </snippet> <snippet> <crm4>window.opener.parent.|_|;</crm4> <crm5>window.top.opener.parent.|_|;</crm5> </snippet>
Both Mitch Milam MVP and I searched high and low for this solution as the Xrm.Page object is not in the DOM at that same location as the CRM 4 crmForm object. Please let us know if you experience any problems with accessing parent forms and we will try and help you.
From IE Developer Tools
Also, Paul Way has shown that you can access the Xrm.Page object from the Developer Tools console window using the following code.