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 setting 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:
Implementing a new ERP system in an organisation is always a challenge. Users question whether they will be able to cope with analysing the data flow in an integrated system without external support. The accountant wonders whether all the set-up accounts are correct. The chief technologist cannot get rid of troublesome thoughts about whether the routings and boms are set up optimally. This is why it is so important to have a reliable service team to help the company control the system in the post-implementation stage. In this article, we take a look at the issues surrounding the implementation of an ERP system and the benefits of maintaining proactive service support.
328.77 million terabytes of data are generated every day - this is the estimate for the first quarter of 2023 (1). These are massive amounts of data on a global scale. On a smaller scale, such as an enterprise, it's difficult to estimate because it depends on the organisation in question, but one thing is certain - collecting, processing and analysing this data is the key to business success today. Why is the Data Lake service so important for data analysis and reporting in Microsoft Dynamics 365 Finance and Operations? How can you tame the data by integrating Microsoft Power BI analytics with Data Lake? We have drawn up some tips.
The retail industry is still dealing with the effects of the pandemic that lasted almost three years. In addition to this, further global events are causing disruption to the supply chain or financial stability of many retailers globally. As the industry confronts new challenges shaped by economic and geopolitical factors, it also faces trends influenced by changing customer expectations and needs. Here are 5 developments and trends to watch.
An interactive, AI-powered support for sales, customer service, marketing, and supply chain - Microsoft Dynamics 365 Copilot leverages generative AI and natural language processing technology to perform simple, yet time-consuming daily tasks that workload employees but can be automated.