Tuesday, January 25, 2011

To restart the AX using X++

Hi,
To restart the AX using X++ code, follow below steps.

//Restart AX
infolog.shutDown(true);  //Shutdown the AX
WINAPI::shellExecute("ax32.exe");  //Start the AX

Hope it helps you.

Regards,
/Ashlesh

Import xpo files in AX using command line


Hi,
I found the below useful details from some blog.

To execute something in Axapta from outside you can use two ways:
1. Use Business Connector -- this was covered in this group already
2. Use startupcmd parameter when starting ax32.exe

ax32.exe -internal=NOVCS -lazyclassloading -startupcmd=autorun_MyFile.xml

where the XML would be like this:
<?xml version="1.0" encoding="utf-8"?>
<AxaptaAutoRun version="4.0" logFile="C:\MyFile.log">
<!-- what to do? -->
</AxaptaAutoRun>

This XML doesn't really contain anything and thus it wouldn't do anything
special. If you want to import an XPO you can use ImportXpo element and to
run a class you use Run element.

<?xml version="1.0" encoding="utf-8"?>
<AxaptaAutoRun version="4.0" logFile="C:\MyFile.log">
<XpoImport file="C:\Class_MyClass.xpo" />
<Run type="class" name="MyClass" method="main" />
</AxaptaAutoRun>

Hope this is useful to someone.

Regards,
/Ashlesh