Friday, August 8, 2014

Opening specific form in AX from external application or windows shortcut

When working with the last ERP system I used (Infor Visual ERP) we always had the option to create a pretty generic .txt file and convert it to a shortcut so it would open the application, open a specific form and jump to a specific record.

So far in AX I have figured out how to open AX from an external source and jump to a specific form but I have not figured out how to make it jump to a specific record. Maybe that will be in a later post.

But thanks to http://msdn.microsoft.com/en-us/library/jj677292.aspx I can show you an provide examples on how to open a specific form in AX


Opening AX via a shortcut:

Download the following zip and inside you will find a .vbs file. Simply make a shortcut with the following properties
https://drive.google.com/file/d/0B7mPpWNLDR1Xd1ZxUlRHWHV1OHc/edit?usp=sharing
<location of vbs file>.vbs  -c <company> -d "<menu item name>"
Example : C:\openAX.vbs -c TEST -d "InventQualityOrderTable"


Opening AX via a C# application:

https://drive.google.com/file/d/0B7mPpWNLDR1XRW1xVEpKTGN5MGs/edit?usp=sharing
The above link provide a basic application that will show you how to open AX the only requirement is that you will need to add a reference to the COM object Dynamics AX Client 1.0 Type Library

Then add

using AxClientLib;
  private void button1_Click(object sender, EventArgs e)
        {
            AxClientLib.DynamicsAxApplication axComClient = new AxClientLib.DynamicsAxApplication();
            try
            {
                //find running Ax32.exe
                axComClient.OpenMenuItem("FWM", "BatchTraceStandAloneUIMenuItem", AxClientLib.AxMenuType.DisplayMenu);
            }
            catch
            {
                MessageBox.Show("failed");
            }
        }