I concocted the following bit of code to automate the task of exporting project definitions to XPO files. It is a simple bit of code that allows the user to dump the project definition files to a specified folder.
Exporting Project Definitions
Parsing Date Strings
Dynamics AX provides functions for parsing date strings into a date object but they are limited at best.
The following static method uses the .Net date parsing functionality to create a X++ date object from any valid date string without knowing the year, month, and day sequence or anything else about it for that matter.
It also allows you to specify the value that is returned in case of an invalid string being passed.
Automatic Class Pack/Unpack
A common task associated with creating objects in Dynamics AX is giving them the ability to be packed into a container for storage as a SysLastValue entry.
The common methodology used for this is to declare a version and a list macro in the class declaration and to add the standard Pack and Unpack methods to your class. The problem with this standard methodology is that you must constantly update the version and list macros to add new parameters that you want to store. You then have to deal with the various issues related to tracking all of these version changes, and unpacking them accordingly.
I have developed a version independent method for automatically generating the packed class that makes code maintenance simplistic. The unpacking of the class is just as simple and isn’t subject to the issues associated with tracking packed class versions.
Welcome!
Welcome to my blog. Please check back often as I will be adding more content as soon as I get the site completely up and running.