Five nice-to-haves in Dynamics AX

October 20, 2009 at 21:06
filed under Dynamics AX
Tagged , ,

Here a some functionalities that I think are nice-to-haves in future versions of AX from a developer point of view. I hope they make sense :).

1. Select table where field in set
Consider a situation where you have a set or container filled with recId’s. When you want to loop all records that have one of these recId’s, it would be nice to be able to write something like this:

Set         set = new Set(Types::Int64);
CustTable   custTable;


while select custTable
where custTable.RecId IN set // this will not compile!
// do stuff

The only problem is that there is no ‘in’ operator in AX. You will either have to loop the set and select each record one at the time, or you’ll have to use the Query and QueryBuildRange classes to make this work.
The above example would be much nicer in my opinion.

2. Throwable exception classes
It would be nice to be able to create your own exceptions.
Java, for example, has Throwable and Exception classes that can be extended.
I won’t say that I completely understand these java classes (I’m not a Java guy), but I believe it would force developers to catch only exceptions they can handle, and not just all exceptions.
It would also make it possible to have more information as to why an exception has occoured when you catch it.

3. Try – catch – finally
This is a classic: the try-catch-finally is not supported in AX. When we look at C# for example, a try-catch can have a ‘finally’ block at the end. The code in this block is always executed, even if an exception occoured.

4. Events using CLR Interop
CLR Interop does not support event handling in AX. It would be nice to be able to assign an event handler to an event, so an event can trigger functionality in AX without complicated workarounds involving .NET wrapper classes, infinite loops, services or other creative solutions. (I’m thinking about things like FileSystemWatcher).

5. Code refactoring
When you rename an object in AX (Table, field, class, method, etc), there is no refactoring option. You have to manually rename all other instances of that object.
For example: it would be nice if, when you rename a field, AX had the option to automatically update all methods, forms, etc, where this field was used.


RSS / trackback

  1. sjakalaka

    never used it though, but I guess ‘syntactic renaming’ from the add-ins AOT contect menu does a little something like ‘5. Code refactoring’.

  2. Klaas Deforche


    Good point, but msdn defines the syntactic renaming as “Enables you replace text *within* a specific object. The command is similar to Find and replace.”, so I guess it won’t work across objects.

    I tested it (with 2 classes) and it works as advertised, but it doens’t update other instances unless you select them as well.
    And I can’t seem to get it working with tablefields…

    Maybe if you select them all, or update the cross reference… Either way, it’s not the full blown reliable refactoring other software (like Eclipse) has.