HOWTO: Have items in the shortcuts menu create popup windows

sugarcrmdevelopers —  May 4, 2011 — 3 Comments

A while back Sugar Engineer Lam Huynh did some great writeups on adding and modifying the shortcuts menu for a module, which show how easy it is to make these changes in an upgrade-safe way. One question that has recently come up in the forums is how to not just add links to other pages, but instead have a link that pops up a new window. Since you specify a link as one of the arguments, the code to do this is very simple as shown below ( assuming that http://localhost/sugarcrm/index.php?entryPoint=custompage is the url you wish to open in the pop-up window and mod1 is the name of the module the link is associated with ):

You can use this same pattern to execute any sort of javascript code as a part of clicking the link as well. For example, you could open a YUI dialog window, interact with the page, or make some sort of AJAX request instead just as easily.

3 responses to HOWTO: Have items in the shortcuts menu create popup windows

  1. 

    I tried this and it works fine, but, when the pop up is open, the principal page is in blank with the legend “[object]” instead of the sugar module… What can I do???

  2. 
    Swapnil Shinde July 26, 2013 at 7:22 am

    To stop parent page moving use void as follows.

    $module_menu[] =

    Array(“javascript:void(window.open(‘http://localhost/sugarcrm/index.php?entryPoint=custompage’,’CustomMessage’,’width=900,height=800,scrollbars=yes’));”,”CustomMessage”,”custompage”, ‘mod1’);

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s