Microsoft Dynamics Ax developer's blog

Friday, October 29, 2010

How to open a form in a running Ax client from an external application

Some times ago someone asks me if it possible to open form in running Dynamics Ax application with external code. He don’t want to use AxPath for some reason.
I recalled there is a similar thing in Ax (since version 4.0) – when you receive an event alert message you can click an a link and go to the corresponding alert.
The idea was to reuse alert handling code as much as possible. And I achieved that without changing Ax code at all.
How alert links work?
1. When you start Ax32.exe, it runs the EventDrillDownPoller class, that creates a named pipe with name like “Dynamics\Event\0S-1-5-5-0-686394” (you can use pipelist utility from the SysInternals suite to obtain exact name of your named pipe) where
  • Dynamics\Event\ – is a constant prefix
  • 0 – is a value from the “Drill Down target” field in the “Basic\Setup\Alert\Alert parameters” form
  • S-1-5-5-0-686394 – is a user system session ID
and then time is being initialized, handler of the timer polls named pipe and executes SysStartupCmd descendant when message received.
You can look at \Classes\EventDrillDownPoller\scheduledPoll code to see the details.
2. When you click on the link in e-mail, axhlink.exe protocol handler is executed, it parses url and connects the named pipe obtaining it’s name using “Drill down target” from url and current session id. Then it writes a command to the named pipe.
3. When timeout handler (which was subscribed to the times in 1.) detects there is a new message in the pipe, it just runs a SysStartupCmd and then recreates a named pipe (see \Classes\EventDrillDownPoller\scheduledPoll – unfortunately it uses the current company to detect a drill down target, so if you have different values of the field in different companies ad user changes the current company, you can see it recreating a named pipe with a different name – it can cause mistakes)
So the task is pretty simple
  • Create an autorun startup command configuration file
  • Connect to the named pipe using session id and provided drill down target
  • Write a zero terminated Unicode string with a startup command to the pipe
You can download code example here

Contents:
  • C# sources of sending a message  (command line utility that takes startup command and drop target ID)
  • XML file example
  • XPO with modification for autorun startup command code, adding a parameter to navigate to a specific record (that was additional requirement – it takes table and recID attributes)

Tuesday, August 24, 2010

Seattle

If you live in Seattle or know that area well, could you, please mail me mbelugin@live.ru

Saturday, June 05, 2010

Data/Control flow

I draw Data-Control flow diagrams for better understanding of some process in code. It looks something like that:

dcfd

Legend:

  • ---> – control flow
  • ==> data flow
  • Ellipsis – method
  • Rectangle – data storage
  • Rectangle with rounded corners – class
  • If ellipsis is located on the border of a class – it is a public method

Such diagrams help me later to understand place of some piece of code in some process in system.

It is critical not to draw unnecessary details on a diagram and stay focused on the current task, in other case a diagram will be unreadable. For example diagram in this post is near the edge of readability – lots of intersections are signs of it.

Tuesday, February 23, 2010

Book review: “Microsoft Dynamics AX 2009 Programming: Getting Started”





See the book description on the publisher's site: "Microsoft Dynamics AX 2009 Programming: Getting Started"





When I've received the book, I first thought about beginning of my experience with Ax: in 2003 I worked with BAAN and planned to become a developer for Ax 3. I have decompiled developer's guide and best practice chm, downloaded it to my Sony SL10 and read it for month or two in the Moscow subway during daily commute. I can recall some difficulties I've met and I expect from every book for beginners to go beyond Dev Guide and BP describing these particular areas.



I think the main two topics to learn for every Ax developer are:

  • Dynamics Ax development platform
  • X++ code that implements business logic

Historically, platform was the more clear area docs, but has some dark corners, but business logic was less documented and the knowledge transferred mostly from the code itself, more experienced colleagues, and online communities.

So I tried to search for following topics:

  1. Links to external information sources such as MSDN, Partner Source, internet communities
  2. Data access (Ax have a very specific SQL implementation)
  3. Forms layout
  4. Business logic patterns
  5. Tools and techniques to extract information from X++ code

BTW one of the book reviewers, Harish Mohanbabu, is known by his blog and free Ax tools.

First, the book contains list of online resources links related to Ax, such as blogs, axaptapedia, official sites, so on. The only thing I wish to add it to explain what partner source and what customer source are, and how to get access – it is very frequent question from newbies.

Database manipulation is described in several chapters, the description is easy to understand, full of example screenshots and can be useful for new developers, but I missed description of union joins (which is new to Ax2009 and I haven't seen much usage in the existing X++ code)

Forms-related information is shown mostly by example; you should refer to developer's guide for more detail. I think, it should be better to provide more information on different form layout templates, and some existing form patterns. Anyway, I think, a novice programmer can learn basic form structure prom the chapter and can use some more advanced techniques such as splitters and edit methods.




There are some chapters related to most frequently used business modules, such as inventory, ledger and accounts receivable/payable, each starting with small entity-relationship diagram of basic tables with examples of using Ledger posting framework, adding new dimension, etc..

The topic about tools contains example of usage of cross reference with screenshots, but profiler and trace parser have not been mentioned.

So these were topics that I was interested in due to I remember I had problems with, when I started to learn Ax.

In addition there is lots of information related to:

  • Other platform areas (such as X++ basics, AOT nodes, architecture, File export and import), which have not caused learning problems for me but maybe can cause to other novice developers.
  • Parts of platform I have not used (Application Integration Framework , Enterprise Portal, Webservices) - so I cannot say anything about them

The book contains an example of car rental module (with full sources in xpo's). Chapters of the book describe corresponding pieces of example code and I think it's a good manner to write books for developer.

I definitely recommend the book for novice developers as a good addition to manuals that go with the product and msdn.

Monday, September 28, 2009

fedotenko.info

This is a blog of Dennis Fedotenko - a well known proffessional in Ax functionality and development. He writes rare, but usually his articles can be a key for understanding principles behind ax functionality.

Dennis has a great reputation in Russian Ax community, and now he translated some of his articles to English.

Tuesday, September 22, 2009

San Diego

If you live in San Diego or know that area well, please contact me mbelugin@gmail.com

Это тоже не стоит транслировать на акфорум :)

Thursday, July 30, 2009

Mental framework

Review of the book “Managing your supply chain using Microsoft dynamics ax 2009”

After about 5 years of Ax development I’ve recognized that the model of Dynamics Ax functionality which I have in my brain is like photosynth – some areas, I worked with, covered by consistent pictures, but others are represented by random shots without high level overview.

The majority of existing materials about Ax – like trainings, documentation, so on, use “hands on” approach – little introduction and very detailed description using screenshots, particular sequences of steps in term of buttons, etc.

So I feel that there is a gap between short intros of documentation and very detailed contents (for example Russian docs contains of 2 volumes >1000 pages each).

That’s why I was very interested when Dr. Scott Hamilton sent me kindly the book, which was written to give “mental framework for putting together the details” learned from various sources . So below are my impressions.

The book contains 426 pages, and most of them are text description of Ax functionality: no screenshots, no concrete steps – just text, tables and business process flowcharts. Thus, the information density is quite high.

The book consists of 15 chapters, each dedicated for some functional area. All chapters are in scope of SCM (you can see TOC at Amazon). Each chapter contain description of a functional area, case studies and executive summary.

New features of Ax2009 (such as sites and purchase requisition) are reflected.

What I like about the book

  • The book met my expectations about abstraction level it have no redundant details, which can be obtained from products docs and training, and contains enough for making mental model of SCM modules.
  • There are lots of tables showing how ax behavior depends on parameter combinations – it helps to understand the space of different implementation scenarios.
    table example
  • As I mentioned before the most important features of ax2009 are described

What can be done better

  • Some case studies are very brief – I’d prefer to include more detailed business scenarios and more implementation details. (But maybe I should read some book about common business practice instead – could you recommend me such a book?)

Overall impression

I’d buy the book if I haven’t one. I recommend it for everybody who want to have a consistent view of Ax SCM functionality.

PS. there is also a new book by Dr. Hamilton - Managing Lean Manufacturing using Microsoft Dynamics AX 2009

Saturday, May 30, 2009

AxForm.info for English-speakers

AxForum.info is the one of the largest Russian communities related to Dynamics systems.

Though it has a section in English there are lots of info in Russian there. Some of English speakers read the forum via online translators.

If you have and idea how to make AxForum.info more suitable for English-speaking people, please post to that thread

Thursday, May 21, 2009

Bulgaria

Does anybody from bulgaria reading this blog? Please, contact me mbelugin@gmail.com

вот это не надо транслировать на аксфорум :)

Search for C#

It is obvious for somebody, but it can help somebody novice.

Since version 4 Dyanmics Ax requires .NET framework installation, so you can rely on the fact that .NET FW exists. There is also constantly improving intargetion of .NET in X++, so you can use .NET framework as a huga library of various utilities. For example, Ax uses System.Text.RegularExpression for checking e-mail format.

So sometimes, you can search the internet for code snippet, performing some task, you need, but if you type "http .net" you can get lots of irrelevant results since .net is an often part of web page address. Type "http C#" instead and you probably get what you want.

SQL Server 2008 R2 what's new

Interesting announce of new features in SQL Server 2008 R2

Friday, January 09, 2009

Friday, November 07, 2008

AxPath plugin for Tabax which works with Ax3, Ax4, Ax2009

Now you can download AxPath.dll (with sources) which works with Ax 3, Ax 4, Ax 2009. Previously it worked only if Ax3 was installed.

Ivan fixed it to work with Ax2009, now I have extended it to probe registry keys for Ax2009, Ax4, Ax3 (in that particular order) and work with the version found first.

If you do not know what AxPath and Tabax are - look at http://axaptapedia.com/AxPath, http://axaptapedia.com/Tabax

AxPath plugin originated by AndyD from http://axforum.info

Thursday, September 25, 2008

First experiments with XRefs and MSAGL



Tryng to get more visual represenation of cross references using MSAGL (Microsoft Automatic Graph Layout)

This is only calls inside Tax class. Methods which are called from external places are merked with ">". Methods ahich are called from descendats - with "*"

view complete xps

Simple job generates .dot file from xrefs which can be read my MSAGL.

There is also well known graph layout package - graphviz. (.dot it it's native format)

Friday, July 11, 2008

Sidax & Tabax for Ax2009

Here are first betas for the utilities that works under Ax2009. Tabax now can works with forms outside main Ax window.

download

Tuesday, July 01, 2008

How to hide Content Pane in Ax 2009

Here is a small job, which hides content pane in Dynamics Ax 2009. Content pane can be useful for end users, but when you develop something in can be irritating to see it oon top of all windows every time you click on menu item. So here is a small solution. I plan to add this feature to the future Tabax for Ax 2009


static
void TEST_HideContentFrame(Args _args)
{
#WinApi
HWND contentPane = WinApi::findWindowEx(
WinAPI::findWindowEx(infolog.hWnd(), 0, 'MDIClient', ''),
0,
'ContentFrame',
''
);
;
if (contentPane)
WinApi::ShowWindow(contentPane, #SW_HIDE);
}

Wednesday, June 18, 2008

https://community.dynamics.com


 

Here is announce:

Within the next few weeks you will begin to see the Microsoft Dynamics Community pages located at http://www.microsoft.com/dynamics/community, moving to a new location at https://community.dynamics.com. We are making this move in an effort to streamline the accessibility of all Microsoft Dynamics communities and make the user experience of interacting with community experts and your peers much easier. The newsgroups as you see them today will still be intact, but the web pages which you use today to access them will be different. Plus you'll see more streamlined content and future functionality additions, such as networking tools!


 

To get a jump start on the transition, I would encourage you to register on the new site TODAY – once you do, you can begin to interact with our non-technical role based communities which reside there today for Finanse, Sales & Marketing, and Customer Service professionals.


 

--

Liz Hallen

Online Community Product Manager