SugarCRM: Add a Sub Menu to a Module in Main Menu

This is how you add a new option under a module in the Main Menu on top of the screen.

Lets say you want to add an option “Process Leads” under the Leads module.  To do this:

1. Create a new file in custom/Extension/modules/Leads/Ext/Menus. If the Menus folder doesn’t exist, just make one. We can name the file menu.php.

2. On menu.php file, input codes below:

<?php
global $module_menu;

// This will add the new option
$module_menu[]=Array("index.php?module=Leads&action=ProcessLeads", "Process Leads", "");
?>

In the example above, we assume that the action ProcessLeads is an existing file under custom/modules/Leads with the name ProcessLeads.php but you can also map actions with files.

3.  Just run Repair and Rebuild then logout to see the changes.

Tags: , , , ,

4 responses to “SugarCRM: Add a Sub Menu to a Module in Main Menu”

  1. optimus says :

    🙂 above content not working!!!!! Plz test it & upload corrected code….

    • johndopeit says :

      This is working. Make sure that the paths are correct and you run repair and rebuild.

      • ramblin4me says :

        John,

        I am looking to add the sub-menu items (like you did above) AND the main navigation menu for a custom package I have created which has 7 modules. I want the main menu and sub-menus added via the manifest file, not via the user manually setting them via the “Configure Module Menu Filters” in the Admin panel.

        I am on SugarCRM CE v 6.5.16

        I could go in and use pre_install scripts to edit the tabConfiog.php file in /custom/include (or, if it does not already exist in the custom directory, then copy it from /include and then edit it in the custom directory), but I am hoping that I can do it by incrementally adding the new items only via an additional file – like you did above for the sub-menus.

        The package was built with Module Builder so all required links are in place for the sub-menus; I just need to figure out how to incrementally add to tabCongig.php without actually editing the file.

        Is this possible and if so, can you show me the way?

        Thanks in advance

        Ramblin.

  2. Taneal Bhandari says :

    Great tip here! Quick follow-up. What if I want to change the link generated by Sugar for a Main Menu item? For instance, in your example, instead of adding a new submenu option under the “Leads” module, what if I wanted a click on the “Leads” Main Menu item to link to an external site instead of to the “Leads” module? I can’t seem to find where to override the way in which these links are built out. Running SugarCRM 6.5.7 Professional.

Leave a comment