Tuesday, February 11, 2014

Unit Conversions

Another project I worked on recently involved Unit Conversions ('Eaches' to 'Lbs'). This one was a tricky one because I wasn't sure how each unit would convert to another unit!  There could be a lot of potential conversions that would have to be made.

Fortunately AX can handle of that for us.  On the Unit conversion form:

 
The User will set up the conversions via this Form and that will determine which conversions can be made and how they are made.

When writing your modifications you can use the UnitOfMeasureConverter class that has methods of CanBeConverted and Convert.  Before converting the unit, simply check if it can be converted!

'modifiedField' on the Table or the Form?

I came across a scenario the other day where my project lead wanted certain things to happen upon a field being modified.  He also stipulated that the changes should take place on the Table if at all possible.

In doing a little research I found that if you are modifying a sys form, as I was (SalesTable), then you should avoid making changes like this to the form itself.  In this case, I was actually able to use the SalesTableType class and modify the 'modifiedField' method.  In this method you will find a switch statement:

Simply add the field you want to have things happen upon 'modifiedField' occuring.

Not all objects have a class like this.  In those cases it would be prudent to check the table of the field that you are dealing with.  You can use the 'modifiedField' method there to make things happen.

Tuesday, February 4, 2014

Label file checkout causes AX Client crash

Not sure why this occurs, but sometimes when you try and checkout a Label file via the Label editor, it will cause the AX client to crash.

The simplest solution I have found for this is going to Version Control -> Synchronization log and then Clean the log.  That should allow you to check it out!