I will Explain this by Account - Contact example. The Account have 1-N relationship with the contact, here Account is primary entity and Contact is related entity as shown in the below figure.I placed the IFRAME of name IFRAME_Contact in the Account Entity Detail Tab. I will show the contact associated view in the this IFRAME. Below figure showing the IFRAME in the Account Entity.
The properties of IFRAME is shown in the below figure.
Now we have to write the Code in the Account onload Event that is written below.
var RelatedEntityId="navContacts"; //Explain after Code
LoadViewIFrame(RelatedEntityId);
function LoadViewIFrame(RelatedEntityId)
{
//navigation id of entity that’s associated view is being to be added in Iframe.
var navId = RelatedEntityId;
//Get the object of navigation id
var str = document.getElementById(navId);
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_Contact.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);
}
else
{
return "about:blank";
}
}
}
To get the Related Entity Id we required IE Developer Tool and get the id of related entity (Contact) by clicking on the Related entity as shown in the figure below.
Now Publish the Form and Refresh the Account we can see...
Now the task is completed we can see that now IFRAME containing the Contacts that are related with this particular account.




No comments:
Post a Comment