Wednesday, May 28, 2008

Using the AutoRun parameter to open a form in AX

In AX 4.0 and later you can use a start up parameter called AutoRun and combined with an XML file you can automate a lot of stuff in AX after starting the client.

The command line for AutoRun looks like this:
ax32.exe –StartupCmd=AutoRun_ c:\folder\filename.XML

The XML file holds descriptions of the commands to execute when the client is started.

The following is an example on how you can use this to open the CustTable form immediately after login.

First create the XML fle:

The exitWhenDone tag controls if AX should shut down after completing the tasks listed in the XML file. We don't want that in this case.

I'm saving the file as C:\OpenCustTable.XML.

And then you could create a specfic configuration file to use this start up parameter:

You could of course also just point to this at the command prompt.

That's it...

You can add as many commands as you want to the XML file, so you can really automate a lot of stuff.

The supported commands includes, amongst others:

  • Runnning installation, upgrade or configuration check lists
  • Loading license information
  • Compiling the application
  • Syncronize the database
  • Importing data
  • Importing XPO's
  • Running specific elements (like described on the above example)

Search the Administrator Help for "SysAutoRun" to read the included documentation.


Thomas said...

Hey this is a very usefull hint.

Does anyone know if it's possible to run such xml commands not only while starting but also by clicking a button?

thanks Thomas

Amo said...

I'm really interested in knowing how you can simulate the click on the button.
Also, when trying to launch an xml file, AX generate an error message saying the file isn't a valid xml file...any idea???

janeteblake said...

Still helpful, after all these years! Thanks!

Alexey Lekanov said...

This is very helpful, thank you!
The only thing I can't find more info about is the different options you can use in the XML-file. E.g. how do I click "OK" button in the dialog box which pops up when activating a menu item? Or do anything else with the opened form? Generally: What is possible to achieve with command "Run type = "something" name="somethingName"/"?

Praveen said...

Hey, any body able to achieve clicking ok button on dialog window ? Thanks.

Praveen said...

Hey, any luck on achievein clicking ok button on dialog box when activating menu item ? . Help appreciated. Thanks

Alexey Lekanov said...

No luck, no answer received here...

noel said...

@praveen @alexey This approach is not the best approach to simulate ok button.

In runbasedialog class, ok button is being triggered by calling "prompt" method, you can find inside main method. So your best approach is to create another main (static)method without calling prompt method. You can be creative here :)