How to: Import a Class on Startup
Applies To: Microsoft Dynamics AX 2012 R3, Microsoft Dynamics AX 2012 R2, Microsoft Dynamics AX 2012 Feature Pack, Microsoft Dynamics AX 2012
You can import a class, and execute methods within it without user interaction by starting Microsoft Dynamics AX from the command line with an XML file as input parameter. The XML file specifies the class and methods to use. The result of importing and executing is written to a log file or shown to the user in Infolog.
Executing with no user interaction is useful for any automation of customer tasks, in particular during the test phase.
Create an XML file
On the Microsoft Dynamics AX client computer, create an XML file.
Add tags to the XML file specifying:
The Microsoft Dynamics AX version.
The name and location of the log file.
The XPO file that contains the class to import.
The method to run.
Note
The XML file syntax is described in the documentation for the SysAutoRun Class.
Open a command line window and type
ax32.exe -StartupCmd=AutoRun_ c:\folder\filename .XML
Sample XML file
The following example shows an XML file that can be used to import data silently.
<AxaptaAutoRun version="6.0" logFile="AXAutoCreateClass.log">
<XpoImport file="d:\share\CreateClass.xpo" />
<Run type="class" name="CreateClass" method="main" />
</AxaptaAutoRun>
See also
Run the checklist items without user interaction
How to: Import Data on Startup
Announcements: New book: "Inside Microsoft Dynamics AX 2012 R3" now available. Get your copy at the MS Press Store.