Tuesday 3 September 2013

Execute any command from Dynamics AX application

Hello Techies,

The Microsoft dynamics AX 2009 and 2012 has lots of integration with the other file system. The dynamics ax can be used with lots of commands and we can execute the executable file from this. You can also set the batch jobs activity to execute the commands with this method.

I have created this .bat file to execute commands for dynamics ax application. Here i have mentioned the bat file code as well as the command execution from ax code.

1) How to create bat file?
1.            Open notepad and enter the command that you have to execute.
2.            As I have to execute the close command for ax i used the following line of code.
         @echo off
          taskkill /F /im Ax32.exe

     3. "Save As" the notepad file with selection of "Save as Type:”: "All files" and enter file name with .bat extension.

2) How to call bat file from ax application?
    I have executed the "Close application Code" on the button click.
 
        void btnCloseAppl()
   {
       str path;
       ;
       path="C:\TestFileToCloseAppl\Axclose.bat"; 
       //Kindly check the path may be have to add '\' in between the path 
       winapi::shellExecute(path);
   }

Hope this will help to resolve all the issues regarding executing the commands from the dynamics ax application.

Happy DAXing !


No comments:

Post a Comment