We have a CRM 2011 solution with several custom ASP.NET MVC-based views and forms that are displayed in iframes on entities in CRM. Currently we're doing some analysis on upgrading to CRM 2013, and we've run into a problem with opening entity windows.
We have mostly used window.open
throughout the solution, both in JavaScripts on the CRM side of things, and in the custom ASP.NET MVC application. The URL passed to window.open
is in the following format:
http://crm.contoso.com/Contoso-Org/main.aspx?etn=opportunity&pagetype=entityrecord&id={...}
The problem is that this seems to remember the context when it's opened in CRM 2013, so it just reopens the entity it was opened from. We solved this on the CRM end by using Xrm.Utility.openEntityForm
instead, but it doesn't seem as if that is possible for the custom application, as we don't have access to the Xrm library from inside the iframe. The URL is correct, and if it's copy pasted into a new tab, it correctly loads the desired entity. When loaded with window.open
though, it just reopens the same entity.
Some suggestions have pointed to appending a histKey
parameter consisting of a randomly generated number to the opened URL. However, this does not work consistently - sometimes it opens the correct entity, sometimes it just reopens the current entity - nor is it officially documented anywhere.
Has anyone come across a solution to this?
<a>
which is supposed to open the Account that the Opportunity is related to. Theetn
parameter is set toaccount
and the GUID points to the Account entity. However, when clicking the URL, it just opens the same Opportunity it was opened from instead. So it somehow "remembers" the context it came from, even if it's opened in a new tab. CRM seems to append a hash code which is identical, so there's possibly some internal state at play. – Martin Wedvich