Main menu: life after death

When Navision Attain attained it’s new name, Microsoft Business Solutions-Navision (the one before the current one), many other things changed as well. Good ol’ main menu was gone. Forever.

Main menu was a mighty beast, one of the stronger points of Navision’s user interface at the time. Two factors contributed to this. First, it was structured in such an intuitive way, that no matter which part of the system you were playing around, be it general ledger, sales, manufacturing, warehousing, you name it, you could easily get your way around without spending much time looking for functinos. And for a system with several thousands of separate functions, this was quite a feat. It always had the same, logical structure: two columns, the left one having master data at the top, then journals, then open documents on the bottom; the right one housed posted documents, periodic activities, and setups. Quite a nice structure, indeed. It was totally easy for even the toughest of the users, for all it took them to really master the user interface was, well, around five minutes? The second factor was that you could easily modify not only the main menu itself, but you could create totally new menus, and have different types of users have different main menus, thus easily allowing for role-based experience. No wonder why everybody loved this little guy.

And then they killed him. There are hardly any words to describe the horror I felt when I first opened Microsoft Business Solutions-Navision 4.0: where the heck was the main menu? It got replaced by an Outlook-style navigation pane, which was a stubborn little pal. And it took me quite a while to get my way around it for the first time, severely contributing to my overall disgust with the fact that I am completely lost. And I wasn’t only one out there feeling that way. Majority of Navision partners and existing customers felt just the same way. Funny thing was that new customers found this navigation pane quite a useful tool. What the heck was wrong with me, I wondered? That’s what it feels to be getting old.

In the end, time did me in, I surrendered when I realized that it was gone forever, and that the life was going on all the same, with or without me subscribing. At that point I could either grumpily keep whining about how the world looked like in my times, or I could jump aboard with the rest of the world.

But soon came along my first upgrade project. I had to upgrade a customer from Navision Attain 3.10 to Microsoft Business Solutions-Navision 4.0 SP2, and boy did these guys indulge in the luxury of the main menu. They had about 15 of main menus, designed to fit all sorts of user roles they had, and guess what, they had to preserve that business critical functionality. It felt bad to be me at that time, trying to explain how this thing was gone. Yes, they could have achieved the same functionality with the navigation pane, and in the end they did, but they moaned at length about how they missed the old functionality, how much better it was, and how much they would appreciate if they could have it back.

But they couldn’t have it back. Or could they? A long time has passed since then, and then yesterday I stumbled upon that very question again. Could you have this functionality back in Microsoft Dynamics NAV 4.0 and above? (Yes, I am now switching back to the true name, under which the product goes today).

I found out that, as the matter of fact, you could. I played around a little bit, and discovered how simple it was.

So, instead of just giving you the recipe, I’m going to explain the mechanics behind the solution.

The piece of functionality in charge of main menu in previous versions of Microsoft Dynamics NAV was Codeunit 1 “ApplicationManagement”, namely its function (or trigger, to stay with the product’s internal nomenclature) CompanyOpen. It had a return value of type integer, which simply had to match the ID of the form which contained the main menu you wanted to display. Beside this simple part of code in Codeunit 1, there was some infrastructure supporting the main menu functionality, including standard forms, subforms and setup information in table 91 “User Setup”.

Since version 4.0 all of this was gone: the trigger was changed so that it didn’t return any value, and all of the infrastructure was gone. Even more, if you tried to modify the trigger, and configure it to return the integer value again, and set that integer to a form ID, the system still didn’t display that form.

Now this felt spooky! If you took a previous version database, converted it to new version and opened it with new client, the main menu functionality worked exactly the same way as in previous versions! The only difference was that previous version CompanyOpen trigger returned an integer value, while new version didn’t. So all it would take you to mimic the same functionality in newer versions would to modify the CompanyOpen trigger to look the same as in previous version. But if you did it, it didn’t work.

So, it must be something else. If you export the Codeunit 1 as a text file from both an old version, and a post-4.0 one, you could notice one innocent difference, which could easily slip the scrutiny of an unattentive eye: the trigger ID was 1 in the old version, and 30 in the new one. If you change the trigger ID in the new version back to 1, and have the trigger return an integer value, you would have your old main menu functionality back in the game.

However, there is a huge caveat to this modification, and I encourage you not to rely on it and not to put it into production environment. First of all, it is undocumented, and as with any other undocumented functionality, it is undocumented for a reason: it might change at any time without prior notice. The only reason this functionality was left in the system is probably because of backwards compatibility, so that you could still open and convert the old database to the new version of the client, which is something you normally do during the upgrade process. But it might just as well be dropped from the next service pack release, and if you relied on it, and bet your production environment on it, I wouldn’t like to be you when this happens.

And in the end, the navigation pane functionality is just as useful, and even more flexible than the main menu, and you would do yourself a great favor if you let good ol’ main menu rest in peace.


Vjeko has been writing code for living since 1995, and he has shared his knowledge and experience in presentations, articles, blogs, and elsewhere since 2002. Hopelessly curious, passionate about technology, avid language learner no matter human or computer.

Leave a Reply