Can not get values of dialogField in run() method


Default report of Trial Balance in Microsoft Dynamics AX 2009 does not provide option to get Trial Balance by dimension, let suppose Purpose. I therefore decided to add criterial myself on report and did this successfully.

For this purpose I added a variable of type dimensionCriteria and a dialogField and assigned value of dialogField to variable in getFromDialog method. Now, the only problem I am facing is that despite assigning the value in getFromDialog method I can not get value of dimensionCriterial variable in run() method of the report. I checked and found that values of variable other than mine i.e. fromDate, toDate, are accessible in run() method.

I will be very grateful if anyone of you could help me in resolving this issue.

Thanks in advance


You need to define “dimensionCriteria” in the classDeclaration so it can be accessed in all of the methods. Look at Classes\Tutorial_RunbaseBatch to see how they’re using the dialog and variables.

dimensionCriteria is declared in classDeclaration and I have also included it in one macro (CurrentList macro under CurrentVersion(5)) but when I include it in other macro (CurrentList macro under Version4(4)) it is popping following error upon running the report:

Error executing code: Wrong argument types in variable assignment.

(S)\Classes\SysReportRun_unpack - line 7
(S)\Classes\RunbaseReportStd\unpack - line 40
(S)\Classes\xSysLastValue\getLast - line 20
(S)\Classes\RunBase\getLast - line 9
(S)\Classes\RunBaseBatch\getLast - line 12
(S)\Classes\RunbaseReportStd\getLast - line 6
(S)\Classes\RunBase\promptPrim - line 9
(S)\Classes\RunBase\prompt - line 12
(S)\Classes\RunBaseBatch\prompt - line 32
(S)\Classes\RunBaseReport\prompt - line 13
(S)\Classes\SysReportRun\run - line 13

That just means the unpack/pack is failing I believe. Reset your usage data, or just the usage data around your class.


Not sure what you mean when you say other macro here. Have you tried incrementing the currentVersion?