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

Continue reading

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?

page.html file with anchor links.

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
Defined variables.

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.

Asynchronous call.

App setting file:

App setting file.

After coding app URL protocol can be registered in Windows registry

Under a HKEY_CLASSES_ROOT node build such a tree structure:

Tree-like view of Windows Registry item.

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:

MMS Node Parameters.

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:

Switch method.

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:

Args object.

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

If statement.
More articles
Explore our blog

What can we do for you?

We'd love to hear about your project. Our team will get back to you within two working days.

Thank you for inquiry, we’ve passed it to our sales department, our representative will reach you back in his earliest convenience.
Oops! Something went wrong while submitting the form.