Macros can still be created in Dynamics 365 for Finance and Operations to store a value that will not be modified. They are created in either a macro file or by using the pound define keyword. So we can see that here with our either hash tag or pound define.
However, there is a new modifier to create constant variables. By placing the keyword const before a variable, it will create the value that cannot be modified.
Const allows you to define members on a class and variables in a method that can only be initialized during the declaration. Constant value must be known at compile time. Compiler will replace references to these constants with the literal value.
Const also replaces most use cases of macros.
- IntelliSense in the editor.
- Support for "Go to definition" in the editor.
- Full control of the type for the constant.
- Faster compilation – macros are notorious hard for the compiler to handle.
- None of the macro idiosyncrasies – like the ability to redefine/override.
Reference link: X++ in AX7: Const keyword