29.05.2009, 17:05 | #1 |
Участник
|
mscrm4ever: CRM 4.0 Show Associated-View in IFRAME (AssocViewer)
Источник: http://mscrm4ever.blogspot.com/2009/...in-iframe.html
============== This post is complementary to the other posts that discuss presenting a CRM gird inside an IFRAME. As usually when you display an associated view inside an IFRME some of MS functionality breaks e.g. the automatic refresh when you add an existing member. This post uses the same technique as the N2NViewer but overrides the ms _locAssocOneToMany function in order to know when to refresh the grid. The object exposes the following properties: 1. ParentId – this is the parent entity key. If not specified the viewer uses the current entity crmForm.ObjectId. 2. ParentOtc – this is the parent object type code. Again if not specified the crmForm.ObjectTypeCode is used. 3. RelationshipName – this is the relationship id as it appears in customization. 4. Tabset – this is the name of the tabset parameter which is required for the associated view to work. Use the iedevtoolbar to extract this parameter. Enjoy... function OnCrmPageLoad() { var assocViewer = new AssocViewer("IFRAME_RelatedContacts"); /* Optional - crmForm.ObjectId */ assocViewer.ParentId = 'D74D44AD-36D0-DC11-AA32-0003FF33509E'; /* Optional - crmForm.ObjectTypeCode */ assocViewer.ParentOtc = 1; /* Mandatory - relationship schema name */ assocViewer.RelationshipName = "contact_customer_accounts" /* Mandatory - tabset query string parameter */ assocViewer.Tabset = "areaContacts"; assocViewer.Load(); } function AssocViewer(iframeId) { var av = this; if (crmForm.FormType == 1) { return; } av.IFrame = document.all[iframeId]; if (!av.IFrame) { alert("Iframe " + iframeId + " is missing!"); } var _locAssocOneToMany = null; av.ParentId = crmForm.ObjectId; av.ParentOtc = crmForm.ObjectTypeCode; av.Tabset = null; av.RelationshipName = null; av.Load = function() { if (av.ParentId == null || av.ParentOtc == null || av.Tabset == null || av.RelationshipName == null) { return alert("Missing Parameters: ParentId or ParentOtc or Tabset Name!"); } var security = crmFormSubmit.crmFormSubmitSecurity.value; av.IFrame.src = "areas.aspx?oId=" + av.ParentId + "&oType=" + av.ParentOtc + "&security=" + security + "&tabSet=" + av.Tabset av.IFrame.onreadystatechange = av.OnIframeReady; } av.OnIframeReady = function() { if (av.IFrame.readyState != 'complete') { return; } av.IFrame.contentWindow.document.body.scroll = "no"; av.IFrame.contentWindow.document.body.childNodes[0].rows[0].cells[0].style.padding = "0px"; _locAssocOneToMany = locAssocOneToMany; locAssocOneToMany = av.locAssocOneToMany; } av.locAssocOneToMany = function(iType, sRelationshipName) { _locAssocOneToMany(iType,sRelationshipName); if (sRelationshipName == av.RelationshipName) { av.IFrame.contentWindow.document.all.crmGrid.Refresh(); } } } //Entry Point OnCrmPageLoad(); Источник: http://mscrm4ever.blogspot.com/2009/...in-iframe.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|