CRM 4.0 IFrame: Show Entity’s Associated View

It’s a common requirement to show entity’s associated view (1:N, N:N) in IFrame, the below code works for both 1:N and N:N relationship, it also works on both On-Premise and IFD deployment. All you need to do is find out (IE Developer Toolbar) the ID of the associated link.

The 1:N relationship needs these parameters in the request URL: oId, oType, security, tabSet
The N:N relationship needs an extra parameter: roleOrd in the request URL, which has been involved in the code.

var navId = “nav_new_new_myentity_account”;

if(document.getElementById(navId) != null)
var tmp = document.getElementById(navId).onclick.toString();
tmp = tmp.substring(tmp.indexOf(“‘”)+1, tmp.indexOf(“;”));
var loadArea = tmp.substring(0, tmp.indexOf(“‘”));
var roleOrd =  (tmp.indexOf(“roleOrd”) == -1) ? -1 : tmp.substring( tmp.indexOf(“roleOrd”), tmp.lastIndexOf(“‘”)).replace(“\\x3d”, “=”);
crmForm.all.IFRAME_view.src = (roleOrd == -1) ? GetFrameSrc(loadArea) : GetFrameSrc(loadArea) + “&” + roleOrd;


function GetFrameSrc(tabSet)
if (crmForm.ObjectId != null)
var id = crmForm.ObjectId;
var type = crmForm.ObjectTypeCode;
var security = crmFormSubmit.crmFormSubmitSecurity.value;
var path = document.location.pathname.substring(0, document.location.pathname.indexOf(“edit.aspx”)) + “areas.aspx?”;

return (path + “oId=” + id + “&oType=” + type + “&security=” + security + “&tabSet=” + tabSet);
return “about:blank”;

Author: Arvind Singh

Solution Architect with 15+ years of exp. Dynamics CRM, Power Platform, Azure which includes Solution, Design, Development, Deployment, Maintenance and support experience.

Leave a Reply

Please log in using one of these methods to post your comment: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: