Command Line To Import Data

In Axapta 4.0 you can use the -startupcmd=autorun_ command line option to batch import data is two steps.

 

1. Create an xml file (demoData.xml for example) that looks like this:

<?xml version="1.0" encoding="utf-8" ?>

<AxaptaAutoRun exitWhenDone="true" version="4.0" logFile="axautodata.log">

       <CompanyAccounts >

              <Company name="Demo Company" id="DMO" overwrite="true" />

       </CompanyAccounts>

       <DataImport companyId="DMO" file="demoData.dat" />

</AxaptaAutoRun>

 

2. Then launch the client with command line like this:

ax32.exe -startupcmd=autorun_demoData.xml

 

Notice the prefix autorun is added to the xml file name.  Since exitWhenDone is set to “true”, the client will exit after importing the data.

 

You can see a list of all the tags that are handled by the -startupcmd=autorun_ command by looking in the X++ classDeclaration of SysAutoRun.

 

I work on version 4.0, so I don’t know if it also works in 3.0.