AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 29.05.2009, 17:05   #1  
Blog bot is offline
Blog bot
Участник
 
25,643 / 848 (80) +++++++
Регистрация: 28.10.2006
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, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
Jim Wang: CRM 4.0 IFrame: Show Advanced Find Result View Blog bot Dynamics CRM: Blogs 0 07.05.2009 01:06
Jim Wang: CRM 4.0 IFrame: Show Entity's Associated View Blog bot Dynamics CRM: Blogs 0 06.05.2009 19:05
mscrm4ever: CRM 4.0 Many 2 Many IFrame Viewer Blog bot Dynamics CRM: Blogs 0 12.04.2009 16:05
Microsoft Dynamics CRM Team Blog: Building Rich-Client Dashboards for Microsoft Dynamics CRM with Windows Presentation Foundation Blog bot Dynamics CRM: Blogs 1 31.03.2009 13:24
Microsoft Dynamics CRM Team Blog: List Web Part for Microsoft Dynamics CRM 4.0 Deployment Scenarios Blog bot Dynamics CRM: Blogs 0 30.01.2009 22:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 19:11.