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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 10.06.2013, 22:14   #9  
vasya-serega is offline
vasya-serega
Участник
 
145 / 17 (1) ++
Регистрация: 12.05.2013
Адрес: Украина
Сроки поджимали, поэтому пришлось сделать немного грубовато и не совсем так, как хотелось.

if (customerNotUser)
{
lookuptypeIcons = '/_imgs/ico_16_2.gif:/_imgs/ico_16_8.gif';
lookuptypenames = 'contact:2:Contact,systemuser:8:User';
lookuptypes = '2';
}
else
{
lookuptypeIcons = '/_imgs/ico_16_8.gif:/_imgs/ico_16_2.gif';
lookuptypenames = 'systemuser:8:User,contact:2:Contact';
lookuptypes = '8';
}

document.getElementById("requiredattendees").setAttribute("lookuptypes", lookuptypes);
document.getElementById("requiredattendees").setAttribute("lookuptypenames", lookuptypenames);
document.getElementById("requiredattendees").setAttribute("lookuptypeIcons", lookuptypeIcons);

Xrm.Page.getControl("requiredattendees").addCustomView(contactViewId , 'contact', viewContactName, fetchContactXml , layoutContactXml, false);
Xrm.Page.getControl("requiredattendees").addCustomView(userViewId, 'systemuser', viewUserName, fetchUserXml, layoutUserXml, false);
if(customerNotUser)
{
document.getElementById("requiredattendees").setAttribute("defaulttype", 2);
Xrm.Page.getControl("requiredattendees").setDefaultView(contactViewId );
}
else
{
document.getElementById("requiredattendees").setAttribute("defaulttype", 8);
Xrm.Page.getControl("requiredattendees").setDefaultView(userViewId);
}

Mscrm.Utilities.click(document.getElementById("requiredattendees"));

//А здесь берем, и присваиваем заново значения заново, причем все и сразу
lookuptypeIcons = '/_imgs/ico_16_2.gif:/_imgs/ico_16_8.gif';
lookuptypenames = 'contact:2:Contact,systemuser:8:User';
lookuptypes = '2,8';

document.getElementById("requiredattendees").setAttribute("lookuptypes", lookuptypes);
document.getElementById("requiredattendees").setAttribute("lookuptypenames", lookuptypenames);
document.getElementById("requiredattendees").setAttribute("lookuptypeIcons", lookuptypeIcons);


Если будет время, попробую ваш код. Приведенный выше, конечно, не ахти. Можно ссылку, если не трудно, где можно подробно почитать о параметрах addCustomView ?
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
CRM DE LA CREME! Some more useful javascripts for MS CRM Blog bot Dynamics CRM: Blogs 0 04.05.2010 11:05
Мелкомягкий CRM: Отображение в Lookup’е произвольного поля вместо основного атрибута Blog bot Dynamics CRM: Blogs 3 26.04.2010 19:10
mscrmblog: Mini Preview Window for Contact Lookup Field Blog bot Dynamics CRM: Blogs 0 10.03.2010 01:05
Jim Wang: CRM Filtered Lookup Multi Blog bot Dynamics CRM: Blogs 0 06.08.2009 06:11
mscrm4ever: Displaying a lookup with related entity fields Blog bot Dynamics CRM: Blogs 0 19.03.2009 07:05

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

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

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