30.06.2019, 11:12 | #1 |
Участник
|
ievgensaxblog: MSDyn365FO. How-to extend product dimension lookup to add dimension description.
Источник: https://ievgensaxblog.wordpress.com/...n-description/
============== Recently I saw a question on community forum asking how to extend InventProductDimensionLookup form to add description column, it’s not an obvious task, so I decided to write small blog post about it. InventProductDimensionLookup form is used to lookup all product dimensions, so we will add new display method to retrieve description from EcoResProductMasterDimValueTranslation table. Simple solution would be to extend form data source, but currently (PU27) there is an issue with display methods. Display method added directly to a form data source accepts current record but display method on extension does not accept anything. Without table buffer display method shows value based on a first record in the grid, that does not make any sense. To workaround this issue we will add new display method to a table extension and check if it is called from a form to grab data required. [ExtensionOf(tableStr(InventDim))] public final class InventDim_IM_Extension { public display Name displayDimDescription_IM() { FieldId dimFieldId; EcoResProductRecId product; boolean isCalledFromnventProductDimensionLookup; if (FormDataUtil::isFormDataSource(this)) { FormDataSource dataSource = FormDataUtil::getFormDataSource(this); if (formHasMethod(dataSource.formRun(), formMethodStr(InventProductDimensionLookup, inventDimSetupObject))) { Object formRun = dataSource.formRun(); InventDimCtrl_Frm_Lookup inventDimCtrl_Frm_Lookup = formRun.inventDimSetupObject(); dimFieldId = inventDimCtrl_Frm_Lookup.parmMainSortFieldId(); product = InventTable::find(inventDimCtrl_Frm_Lookup.callerItemId()).Product; isCalledFromnventProductDimensionLookup = true; } } Name dimName; if (!isCalledFromnventProductDimensionLookup) { return dimName; } LanguageId userLanguageId = new xInfo().language(); RecId dimRecId; switch (dimFieldId) { case fieldNum(InventDim, configId): EcoResConfiguration ecoResConfiguration; EcoResProductMasterConfiguration ecoResProductMasterConfiguration; select firstonly RecId from ecoResProductMasterConfiguration where ecoResProductMasterConfiguration.ConfigProductMaster == product exists join ecoResConfiguration where ecoResConfiguration.RecId == ecoResProductMasterConfiguration.Configuration && ecoResConfiguration.Name == this.(dimFieldId); dimRecId = ecoResProductMasterConfiguration.RecId; break; case fieldNum(InventDim, inventSizeId): EcoResSize ecoResSize; EcoResProductMasterSize ecoResProductMasterSize; select firstonly RecId from ecoResProductMasterSize where ecoResProductMasterSize.SizeProductMaster == product exists join ecoResSize where ecoResSize.RecId == ecoResProductMasterSize.Size && ecoResSize.Name == this.(dimFieldId); dimRecId = ecoResProductMasterSize.RecId; break; case fieldNum(InventDim, inventColorId): EcoResColor ecoResColor; EcoResProductMasterColor ecoResProductMasterColor; select firstonly RecId from ecoResProductMasterColor where ecoResProductMasterColor.ColorProductMaster == product exists join ecoResColor where ecoResColor.RecId == ecoResProductMasterColor.Color && ecoResColor.Name == this.(dimFieldId); dimRecId = ecoResProductMasterColor.RecId; break; case fieldNum(InventDim, inventStyleId): EcoResStyle ecoResStyle; EcoResProductMasterStyle ecoResProductMasterStyle; select firstonly RecId from ecoResProductMasterStyle where ecoResProductMasterStyle.StyleProductMaster == product exists join ecoResStyle where ecoResStyle.RecId == ecoResProductMasterStyle.Style && ecoResStyle.Name == this.(dimFieldId); dimRecId = ecoResProductMasterStyle.RecId; break; } if (dimRecId) { dimName = EcoResProductMasterDimValueTranslation::getDescriptionOrDefaultDescription(dimRecId, userLanguageId); } return dimName; } } Now extend the form and add new control If you cannot select data method from the drop down, compile class first and then it should be available. Источник: https://ievgensaxblog.wordpress.com/...n-description/
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
01.07.2019, 04:38 | #2 |
Участник
|
Цитата:
Simple solution would be to extend form data source, but currently (PU27) there is an issue with display methods. Display method added directly to a form data source accepts current record but display method on extension does not accept anything. Without table buffer display method shows value based on a first record in the grid, that does not make any sense
|
|
01.07.2019, 08:47 | #3 |
Участник
|
Там в 1 методе косяк, FormUtil класс или как-то так, туда приходит буфер, все с ним хорошо, а потом какие-то интеллектуалы из него получают датасоурс и передают его как параметр в dictClass.callStatic. На яммере 3 месяца назад писали, что об этом знают и баг в очереди но без PU, видимо не приоритет. Как будут чинить это вопрос хороший, наверное допишут костыль и будут проверять сколько параметров у метода, как уже сделано чтобы отличить edit методы.
|
|
01.07.2019, 10:18 | #4 |
Участник
|
https://www.youtube.com/watch?v=MC96YUdWFt4
к концу 4й минуты видео в голове отчетливо проявляются цитаты великого мыслителя Нахуа. к конце 13й минуты наступает дзен и разливается восхищение от тотальной бессмысленности труда создателей. просто, чтобы было "красиво". |
|
|
За это сообщение автора поблагодарили: twilight (1). |
01.07.2019, 11:08 | #5 |
Участник
|
А чем "красиво" не повод? А то выходит что надо просто пойти и умереть.
|
|
01.07.2019, 11:11 | #6 |
Участник
|
вполне.
а вариант "красиво" и "с пользой" совсем не рассматривается? например, следующее видео от этих же авторов https://www.youtube.com/watch?v=hvEh8xrgqZY вполне можно озаглавить "из говна и палок". но впечатления от проделанной работы совсем другие. |
|
01.07.2019, 11:17 | #7 |
Участник
|
ИМХО, польза и красота субьективные критерии. На лодке можно плыть, а в шалаше жить, но вот почему-то шалаш полезней...
|
|
01.07.2019, 11:21 | #8 |
Участник
|
?!
лодке?! Как скажешь. Так выпьем за специально обученных людей, которые умеют продать этот продукт! |
|
01.07.2019, 11:35 | #9 |
Участник
|
А что там было в первом видео? Не паравоз же.
|
|
01.07.2019, 11:42 | #10 |
Moderator
|
|
|
01.07.2019, 11:50 | #11 |
Участник
|
Для меня загадка откуда у mazzy такие познание в творчестве этих ребят А лодка настолько же хороша насколько и это блог.
|
|
01.07.2019, 11:57 | #12 |
Участник
|
Цитата:
а запоротые display/edit методы - норм. как и тотально бессмысленная работа над текущими финасовыми аналитиками. подкину дровишек: блог бесплатный. а вот продукт за деньги |
|
01.07.2019, 12:13 | #13 |
Участник
|
Мне блог нравится и лодка была красивая.
Я бы назвал их "недореализованные" display/edit методы. Проблема в том, что всем пофиг на их реализацию как и на много других мелких вещей. |
|
|
|