Export (0) Print
Expand All

Execute Startup Commands

Use the SysStartupCmd class framework to execute commands at startup.

When Microsoft Dynamics AX starts, calls are made to the *startup methods on the application-substituted kernel classes Application (Application.startup) and Info (Info.startup).

Caution noteCaution

The *startup methods are used for vital system and version-specific calls—never directly modify these methods. Instead, use the SysStartupCmd framework. Serious consequences may follow if the SYS layer versions of the startup methods are not called.


When Microsoft Dynamics AX is started, calls are executed in the sequence shown in the following code.

appl.startup() // The SysStartupCmd class is instantiated here.
sysStartupCmd.applInit()
super()
sysStartupCmd.applRun()

info.startup()
sysStartupCmd.infoInit()
super()
sysStartupCmd.infoRun()

The commands that are available when Microsoft Dynamics AX starts are listed in the SysStartupCmd.construct method (available in the Classes node in the Application Object Tree (AOT)). The commands include the following:

  • AutoRun

  • AOTImport

  • Synchronize

  1. Create a class that extends the SysStartupCmd class to perform your specific task.

    For example, in the standard application, the SysStartupCmdBuildNoSet class is used to set the build number. Use a similar approach for your task.

  2. Modify the construct method on the SysStartupCmd class so that your class is called.

    Following is an example.

    switch (s)
    {
        // Code lines are left out here. 
        case 'autorun':
            sysStartupCmd = new SysStartupCmdAutoRun(s,parm);
            break;
        // Code lines are left out here.
    }
    
  3. Add parameters (if necessary) to commands that are executed on startup to the Command to run at application startup field on the General tab in the Microsoft Dynamics AX Configuration Utility.

    Instead of giving the command from the Microsoft Dynamics AX Configuration Utility, you might choose to use the command-line parameter -startupcmd=MyCommand.

Community Additions

ADD
Show:
© 2014 Microsoft