Macros in axapta
In Axapta’s predecessor, macros were widely used. The predecessor did not support
classes, so macros were used instead. This might be the reason that macros are a part of
MorphX today. In MorphX macros are not commonly used. A few places make use of
macros such as keeping track of the list of fields stored when using dialogs. It is
recommended only to use macros to define constants. Macros are not supposed to be
used for code, as reusing code from macros is not flexible as using methods.
Macros can be created under the Macro node in the AOT, as a local macro in a method
or a single line defining a constant. The main difference between a macro and a method
is that a macro has no variable declaration part, and the code in a macro is not validated
for errors before executed from a method. This is one of the main reasons not to put
code in macros, as it makes the code more difficult to read.