19.09.2012, 20:11 | #1 |
Участник
|
ax-erp: How to use default dimensions as Dialog fields in dialogs [Dynamics AX 2012]
Источник: http://microsoft-dynamics-ax-erp.blo...as-dialog.html
============== Friends, This post will help you how to add default dimensions as dialog fields on the dialogs in AX 2012. There is a new class that has been introduced in AX 2012 by name DialogFieldDimensionDefaultingController to handle this. This class has been used in very few places in standard AX 2012 and is little tricky to pick the relevant code. So this post will be handy for all developers at least at high level to get the default dimensions as dialog fields. Below is the dialog with the default dimensions as dialog fields. Code walkthrough: Create a new class and methods as shown below one by one class SR_DimensionDialog extends RunBase { #DimensionDefaultingFieldSetElements DimensionAttributeValueSetStorage dimAttrValueSetStorage; DialogFieldDimensionDefaultingController dfDimDefaultingControllerChecksAndValues; DimensionDefaultingFieldSet dimensions; Dialog dialog; #DEFINE.CurrentVersion(1) #LOCALMACRO.CurrentList dimensions #ENDMACRO } Object dialog() { dialog = super(); dialog.caption("DialogFieldDimensionDefaultingController example"); dfDimDefaultingControllerChecksAndValues = dialog.addDimensionDefaultingController(); //dfDimDefaultingControllerChecksAndValues.initWithChecksAndValues(false, false, false, true, 0, "Dimensions as dialog fields example", "@SYS104593"); dfDimDefaultingControllerChecksAndValues.initWithValues(false,false,true,0,"Dimension – dialog fields"); return dialog; } boolean getFromDialog() { dfDimDefaultingControllerChecksAndValues.save(); dimensions = dfDimDefaultingControllerChecksAndValues.value(); returnsuper(); } publiccontainer pack() { ; return [#CurrentVersion, #CurrentList]; } void run() { // dimAttrValueSetStorage = DimensionAttributeValueSetStorage::find(Dimensions[#DimDefaultingFieldSet_AttrValueSetId]); } publicboolean unpack(container packedClass) { boolean ret = false; Version version = RunBase::getVersion(packedClass); switch (version) { case #CurrentVersion: [version, #CurrentList] = packedClass; ret = true; break; } return ret; } staticvoid main(Args args) { SR_DefaultDimensionsDialog sr_DefaultDimensionsDialog; sr_DefaultDimensionsDialog = new SR_DefaultDimensionsDialog(); if (SR_DefaultDimensionsDialog.prompt()) { SR_DefaultDimensionsDialog.run(); } } Some more methods you can try in the DialogFieldDimensionDefaultingController class are shown below. I have used initWithValues as I am interested in only capturing the dialog values. If you use InitWithChecksAndValues method, your dialog looks like below However you need to write additional code to make it work though. Explore the other methods based on your requirements. That’s all for now. Источник: http://microsoft-dynamics-ax-erp.blo...as-dialog.html
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору. |
|
|
Опции темы | Поиск в этой теме |
Опции просмотра | |
|