In the last couple of weeks, I have had a few cases where Dexterity command based menus for addon products no longer showed in Microsoft Dynamics GP 2010 after Service Pack 3 was installed.
In each of the cases, a review of the menu creation procedures identified that the code was actually incorrect. Once the code was fixed to use the correct dictionary numbers for the AddCommandToMenu() function, the menus worked perfectly.
The change in behaviour was caused by the fixing of an issue with the Dexterity Function Library command Command_GetTag() and its handling of dictionary IDs. If the menu creation code was written correctly, this fix would not cause any problems. Only incorrectly written code that previously worked, would no longer work.
Below are some rules for the dictionary numbers to use:
For example:
Seq = 0; Status = AddCommandToMenu(DYNAMICS, resourceid(form Command_System), resourceid(command CL_Cards of form Command_System), Seq, MBS_DICT, resourceid(form MBS_Commands), resourceid(command MBS_Setup of form MBS_Commands), true, LoadMode); if Status <> OKAY then error "Could not add command Menu MBS_Setup."; end if;
Seq = 0; Status = AddCommandToMenu(DYNAMICS, resourceid(form MBS_Commands), resourceid(command MBS_Setup of form MBS_Commands), Seq, MBS_DICT, resourceid(form MBS_Commands), resourceid(command MBS_Install of form MBS_Commands), true, LoadMode); if Status <> OKAY then error "Could not add command MBS_Install."; end if;
should be
Seq = 0; Status = AddCommandToMenu(DYNAMICS, resourceid(form Command_System), resourceid(command CL_Cards of form Command_System), Seq, Runtime_GetCurrentProductID(), resourceid(form MBS_Commands), resourceid(command MBS_Setup of form MBS_Commands), true, LoadMode); if Status <> OKAY then error "Could not add command Menu MBS_Setup."; end if;
Seq = 0; Status = AddCommandToMenu(Runtime_GetCurrentProductID(), resourceid(form MBS_Commands), resourceid(command MBS_Setup of form MBS_Commands), Seq, Runtime_GetCurrentProductID(), resourceid(form MBS_Commands), resourceid(command MBS_Install of form MBS_Commands), true, LoadMode); if Status <> OKAY then error "Could not add command MBS_Install."; end if;
Note: Using Runtime_GetCurrentProductID(), or a variable/parameter based on Runtime_GetCurrentProductID(), instead of a fixed product ID constant is better as it works correctly for test mode as well as runtime mode. This is because Runtime_GetCurrentProductID() returns 0 when in test mode and the addon product's dictionary ID when in runtime mode.
Hope this helps
David
Posting from Mark Polino at DynamicAccounting.net
msdynamicsgp.blogspot.com/.../quick-tip-getting-command-based-menus.html
PLEASE READ BEFORE POSTING
Please only post comments relating to the topic of this page.
If you wish to ask a technical question, please use the links in the links section (scroll down, on right hand side) to ask on the Newsgroups or Forums. If you ask on the Newsgroups or Forums, others in the community can respond and the answers are available for everyone in the future.