Adding to Microsoft Dynamics GP menus

We recommend that you add menu items for your integration to only the following menus:

 

The other menus are managed by the Microsoft Dynamics GP application, and should not contain any third-party menu items.

Adding commands

Microsoft Dynamics GP provides the AddCommandToMenu() global function that you will use to add commands to menus. Use the table in the section Menu structure in Microsoft Dynamics GP to find the form name and command list (menu or submenu) to which you want to add the command. You will also use the resourceid() function to look up the resource IDs of the command forms and commands.

For example, the following code adds the IG_Lead_Maintenance command to the end of the CL_Sales_Cards command list.

Seq = 0;
Status = AddCommandToMenu(DYNAMICS,
	resourceid(form Command_Sales),
	resourceid(command CL_Sales_Cards of form Command_Sales),
	Seq,
	3333,
	resourceid(form Command_IG_Sample),
	resourceid(command IG_Lead_Maintenance of form Command_IG_Sample),
	true,
	LoadMode);

Notice that the resourceid() function is used to look up the resource IDs of the commands and command forms accessed, such as the CL_Sales_Cards command and the Command_Sales form.

Microsoft Dynamics GP also provides the AlreadyExistsOnMenu() function defined on the syMenuObj form that you will use to determine wether a specific command has already been added to a menu. This is useful when your integration is creating the default set of menus, and you want to avoid creating duplicate menu items.

Adding separators

Separarators are a special built-in command that you can add to menus. Like other commands, you add them using the AddCommandToMenu() function. The following special constants are used to refer to the separator command:

[spacer]

Constant

Description

CMD_BUILTINCMD_DICTID

Specifies the ID of the dictionary that contains the separator built-in command.

CMD_BUILTINCMD_FORMID

Specifies the resource ID of the form that defines the separator built-in command.

cmdSeparator

The built-in separator command.


For example, the following code adds a separator to the end of the CL_Sales_Cards command list.

Seq = 0;
Status = AddCommandToMenu(DYNAMICS,
	resourceid(form Command_Sales),
	resourceid(command CL_Sales_Cards of form Command_Sales),
	Seq,
	CMD_BUILTINCMD_DICTID, 
	CMD_BUILTINCMD_FORMID, 
	resourceid(command cmdSeparator),
	true,
	LoadMode);

When you add your menu items, we recommend that you add them to the end of the menu or submenu. You should also consider using a separator to separate your items from the default items.


Adding submenus

To add a submenu, you will use the AddCommandToMenu() function to add a command list command to an existing menu. Once the command list has been added, use this same function to add commands to the new submenu.


Documentation Feedback