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

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 11.04.2019, 20:12   #1  
Blog bot is offline
Blog bot
Участник
 
25,574 / 848 (80) +++++++
Регистрация: 28.10.2006
stoneridgesoftware: Create Custom Dialog on Form with Customer Lookup for a Specific Financial Dimension in D365 FinOps
Источник: https://stoneridgesoftware.com/creat...n-d365-finops/
==============

Recently I had a request to create a custom form in Dynamics 365 Finance and Operations. One requirement was that prior to the form opening, it would prompt the user for a date (defaulted in with the current date) and a value from a specific financial dimension.  The working prompt form would look like this (with the custom lookup code on the financial dimension):



So, here’s how I would a custom dialog on a form with a customer lookup for a specific financial dimension in D365 FinOps. The dialog code itself is not hard to do.  It simply is placed in the init() method of the main form:

/// /// Build the dialog that prompts the user for a date and a site to process /// public void init() { super(); // build the dialog for prompt Dialog dialog = new Dialog("Label goes here",element); DialogField dfDate = dialog.addField('Date1980','Date'); dfDate.value(DateTimeUtil::getToday(DateTimeUtil::getUserPreferredTimeZone())); DialogField dfDimValue = dialog.addField('DimensionValue','LocationSite'); FormBuildStringControl control; control = dfDimValue.control(); // use the custom lookup control.registerOverrideMethod('LookUp','dimLookup',this); // if we click OK, we run, otherwise, close the form if (dialog.run()) { dlDate = dfDate.value(); dlDimValue = dfDimValue.value(); boolean dlClosed = dialog.closedOk(); if (dlClosed) { // code does in here } } else { element.close(); } }This key line in the code above is the following:

control.registerOverrideMethod('LookUp','dimLookup',this);This line allows us to override the lookup method of the control in the dialog, and replace it with our custom code.  This method exists on the form as well.

/// /// This is the custom lookup code for the LocationSite financial dimension field on the user prompt dialog /// /// private void dimLookup(FormStringControl _control) { Query query = new Query(); QueryBuildDataSource qbdsDimensionFinancialTag = query.addDataSource(tableNum(DimensionFinancialTag)); QueryBuildRange qbrFinancialTagCategory = qbdsDimensionFinancialTag.addRange(fieldNum(DimensionFinancialTag, FinancialTagCategory)); qbrFinancialTagCategory.value(strFmt('%1', DimensionAttribute::findByName(dimName, false).financialTagCategory())); SysTableLookup sysTableLookup = sysTableLookup::newParameters(tableNum(DimensionFinancialTag), _control,true); sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Value), true); sysTableLookup.addLookupfield(fieldNum(DimensionFinancialTag, Description)); sysTableLookup.addSelectionField(fieldNum(DimensionFinancialTag, FinancialTagCategory)); sysTableLookup.parmQuery(query); sysTableLookup.performFormLookup(); }This is pretty standard lookup code using the SysTableLookup class.  That is all that is needed to accomplish my requirements (other than some specific requirement code that is not relevant here).

You can use this method to create any custom dialog form opening and have a customer lookup for any specific financial dimension in D365 Finance and Operations. If you have any more questions on how to do this yourself, please contact us here at Stoneridge Software.



Источник: https://stoneridgesoftware.com/creat...n-d365-finops/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
saurav-nav: NAV 2018 - Lots of New Objects! Blog bot NAV: Blogs 0 04.12.2017 10:11
stoneridgesoftware: Creating a Default Lookup Form with Filter in Dynamics AX Blog bot DAX Blogs 0 29.07.2016 02:37
dynamicsaxtraining: Vendor returns Blog bot DAX Blogs 0 11.10.2012 00:11
dynamicsaxtraining: Purchase Blog bot DAX Blogs 0 11.03.2012 05:25
wiki.dynamicsbook: Changes Made in Navision Attain 3.60 Blog bot Dynamics CRM: Blogs 0 02.09.2008 13:23

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

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

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