Microsoft Dynamics® AX 2009: How to Call AX 2009 from an External Application and Open a Specific Form/Record
(This post courtesy of Natalia Efimtseva)
Recently I worked with my colleague, Max Belugin, who is an expert in Dynamics. We were solving one interesting question—how you can activate and open a specific AX 2009 form/record from an external application or code.
You can use following approaches to open AX from an external environment:
Recently I worked with my colleague, Max Belugin, who is an expert in Dynamics. We were solving one interesting question—how you can activate and open a specific AX 2009 form/record from an external application or code.
You can use following approaches to open AX from an external environment:
1. COM API
Unfortunately, at the current moment .NET Business Connector doesn’t implement UI function, and thus it is not possible to open a specific AX form. But we can register AX32.EXE as a COM Object.static void Connect(string[] args)
{
AxClientLib.DynamicsAxApplication dynamicsClient;
try
{
//find running Ax32.exe
dynamicsClient = (AxClientLib.DynamicsAxApplication)System.Runtime.InteropServices.Marshal.GetActiveObject("Dynamics.Application");
}
catch
{
//Launch new Ax32.exe
dynamicsClient = new AxClientLib.DynamicsAxApplicationClass();
}
if (dynamicsClient != null)
{
//Run form
dynamicsClient.OpenMenuItem("DMO", "SalesTable", AxClientLib.AxMenuType.DisplayMenu);
}
}