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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 10.01.2018, 05:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,459 / 846 (79) +++++++
Регистрация: 28.10.2006
ievgensaxblog: D365FOE. How to override form data source field lookup method.
Источник: https://ievgensaxblog.wordpress.com/...lookup-method/
==============

A long time ago, I wrote a blog post explaining how to override form data source field methods. I skipped lookup, most popular method, because it did not work and logged a bug with MS hoping that it would be fixed soon. It took more time than I expected, but finally, it works!

Here is a small example how to override it. I’m going to use approach similar to previous post, full example is available on GitHub. Version I’m using is 7.3 PU13.

/// /// Handles events raised by SalesTable form./// public class SalesTableEventHandler{ /// /// Post event handler for SalesTable SalesLine Initialized event. /// /// /// [FormDataSourceEventHandler(formDataSourceStr(SalesTable, SalesLine), FormDataSourceEventType::Initialized)] public static void SalesLine_OnInitialized(FormDataSource _sender, FormDataSourceEventArgs _e) { var overrides = SalesTableFormExtensionOverrides::construct(); _sender.object(fieldNum(SalesLine, ItemId)).registerOverrideMethod(methodStr(FormDataObject, lookup), methodStr(SalesTableFormExtensionOverrides, ItemId_OnLookup), overrides); }}/// /// Contains methods which are used to override SalesLine data source field methods./// public class SalesTableFormExtensionOverrides{ protected void new() { } /// /// Constructs a new instance of SalesTableFormExtensionOverrides class. /// /// /// A SalesTableFormExtensionOverrides class. /// public static SalesTableFormExtensionOverrides construct() { return new SalesTableFormExtensionOverrides(); } /// /// Provides a lookup for the InventTable table /// /// /// The form string control object with which to perform the lookup. /// public void ItemId_OnLookup(FormStringControl _callingControl) { SysTableLookup sysTableLookup = SysTableLookup::newParameters(tableNum(InventTable), _callingControl); sysTableLookup.addLookupfield(fieldNum(InventTable, ItemId)); sysTableLookup.addLookupfield(fieldNum(InventTable, NameAlias)); sysTableLookup.performFormLookup(); }}As you may notice, signature of this method is different to signature of other methods, like validate or jumpRef. They accept FormDataObject as a parameter and lookup() accepts FormStringControl. It looks a bit inconsistent for me and we need to be extra careful here because you can register override method with any signature and get error in the run-time.




Источник: https://ievgensaxblog.wordpress.com/...lookup-method/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
NAV Team: How to: Enable Import/Export of Bank or Payroll Files Using the Data Exchange Framework Blog bot Dynamics CRM: Blogs 0 18.10.2013 02:33
dynamicsaxtraining: Vendor returns Blog bot DAX Blogs 0 11.10.2012 00:11
dax-lessons: How to find out the source of data on SSRS reports [AX 2012] Blog bot DAX Blogs 0 01.06.2012 19:11
CRM DE LA CREME! Some more useful javascripts for MS CRM Blog bot Dynamics CRM: Blogs 0 04.05.2010 11:05
gatesasbait: How to define a custom lookup form for an extended datatype Blog bot DAX Blogs 0 09.07.2008 22:05
Опции темы Поиск в этой теме
Поиск в этой теме:

Расширенный поиск
Опции просмотра

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

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

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 12:26.
Powered by vBulletin® v3.8.5. Перевод: zCarot
Контактная информация, Реклама.