How to open AX 2012 form from intranet web page or external application

How to open AX 2012 form from intranet web page or external application

Published on
Jun 16, 2015

Hi fellow Microsoft Dynamics AX coders!


Today we will try to solve problem of opening Dynamics AX 2012 form from intranet web page. And I believe that given solution is flexible enough to be easily extended for using not only with a web pages.


During googling for this issue I have not found a solution which would be 100% satisfactory to me. Using named pipe approach is great but what if Dynamics AX client is not started yet? On the other hand there is no such a problem when we try to simply call ax32.exe with proper parameters but every call will open another Dynamics AX client instance which can shortly lead to getting out of resources on a target machine. So I decided to join this two solutions into one.

What we need to open AX window from external app is:

  • Link placed on a web page
  • Small console app written to open new AX client or open only window if client is already running
  • New URL protocol linked with our new app registered in Windows registry
  • A couple of amendments done to SysStartupCmd class to accommodate opening of new window with parameters

Let’s do some coding now.

How should link on a web look like?

mms – it is name of our new protocol, you can call it as you want as long it is consistent with windows registry

MMSStartupElementAction – it is a prefix, used in SysStartupCmd::constuct to call appropriate class

_ - special char between prefix and menu item path

\Menu&Items\Display\MMSSalesQuotationProjTableForEdit – menu item path

? – Special char between menu item path and given parameter

EMUK-00021 – unique record identification, it can be anything dependent on type of data available in external system, can be RecId or like in this example quotation ID.

Now is time to write small console app which will be dealing with opening AX windows

From args we have to remove URL protocol name to have only proper command which will be send to Dynamics AX. Next thing is to obtain pipe name to create proper client stream object. Name consists with three parts:

  • Constant string: “Dynamics\Event\”
  • Value which can be changed in (AX 2012): System Administrator\Setup\System parameters\Alerts\Drill-down target
  • User SID

When trying to connect to pipe (client.Connect()) app is waiting maximum 1 second before TimeOut exception is thrown. In such a case program will try to call Ax32.exe (from location taken from app settings file). Please note that in order for parameters work properly there is need to add “-StartupCmd=” string on the beginning of the command.

If client is successfully connected to pipe app will simply send binary data to a Dynamics pipe.

Every app activity is logged to a text file which is very useful while debugging as usually it is very difficult to gather sufficient information for troubleshooting from non-technical users.

App seting file:

After coding app URL protocol can be registered in Windows registry

Under a HKEY_CLASSES_ROOT node build such a tree structure:

The most important node is command one. Value should consist full path to your app and %1 for parameters:

MMS node parameters values should be like this:

Now is the time to process command in AX and open a window

It does not matter if AX is called using both named pipe and ax32.exe as

SysStartupCmd::construct is called in every case.

I extended switch method adding my own prefix and a new class which extends SysStartupCmd class:

Class is really simple the only tricky element is how to open form in Dynamics AX having given path.

First of all TreeNode object must be created based on given path.

Let’s prepare also Args object to pass parameters to form. Like record which should be opened:

And now the only thing that left is to use AOTrun method with args passed to open AX form:

Share it
Written by
Michal Lisowski

Microsoft Dynamics developer since 2008 (starting from Microsoft Axapta 3.0) with experience in multiple Dynamics AX modules (Financial, Sales and marketing, Production, AX People). Specialises in Dynamics integration with other external systems. Passionate about mobile programming and every sport connected with a board.