Automation, AutoRun, AX, AX 2012, Build Scripts, Dynamics AX, PowerShell
The obvious posts following the Start-AXBuildCompile post would be to talk about the AOT client compile, compiling IL and synching the AX data dictionary. However, all of these processes rely on the AX SysAutoRun functionality. To prep for these upcoming PowerShell functions, I will walk you through the Get-AXAutoRunXML function.
The SysAutoRun class is a class in AX that allows you to run functionality in AX at startup. This becomes the entry point for most, if not all of the processes that you want to automate in AX. The Get-AXAutoRunXML function allows you to build an AxaptaAutoRun xml very easily that can then be used to run different processes in AX for your automation.
The Get-AXAutoRunXML takes 3 parameters:
- ExitWhenDone (If this parameter is passed, AX will run the process and exit afterwards)
- LogFile (Determines if the process makes the infolog available for output and where that file is saved)
- Command (This parameter is used to choose what process AX runs at startup)
This is a very straightforward function that can be found in Codeplex. It takes the parameters and returns an AxaptaAutoRun xml that can then be passed into AX to allow multiple AX processes to be automated (e.g. client compile, IL compile, data dictionary sync).
If you examine the function, you will see that the xml has a version property in the header. I struggled with whether or not to make this property a parameter of the function. Ultimately, I decided that if the AxaptaAutoRun version is changed, I would more than likely have to update this function to account for changes in the xml. For this reason, I decided to leave it as a hardcoded value but this could change in the future.