Показать сообщение отдельно
Старый 06.05.2009, 19:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,487 / 846 (79) +++++++
Регистрация: 28.10.2006
Jim Wang: CRM 4.0 IFrame: Show Entity's Associated View
Источник: http://jianwang.blogspot.com/2009/05...ssociated.html
==============

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 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);
}
else
{
return "about:blank";
}
}



Enjoy it! ;-)


Источник: http://jianwang.blogspot.com/2009/05...ssociated.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.