Welcome, Guest
Username: Password: Remember me

TOPIC: How to add a Custom Top Button to Any Subpanel

How to add a Custom Top Button to Any Subpanel 3 years 5 months ago #29407

  • angrymob
  • angrymob's Avatar
  • Offline
  • Premium Member
  • Posts: 130
  • Thank you received: 36
  • Karma: 13
I needed this for a custom moduel I am building.

Here are the steps...

Create file in the following format...


In this example I will create a custom button that will eventually call a new popup page or ajax popup and guide the user through some steps before creating a record.

So I will create SugarWidgetSubPanelRSendButton.php

I am using SugarWidgetSubPanelSendInvitesButton as a template..
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');


//class SugarWidgetSubPanelSendInvitesButton extends SugarWidgetSubPanelTopButton
class SugarWidgetSubPanelRSendButton extends SugarWidgetSubPanelTopButton
    function display($defines, $additionalFormFields = null)
        global $mod_strings;
        //$button = '<input class="button" onclick="document.location=\'index.php?module=FP_events&action=sendinvitemails&record='.$defines['focus']->id.'\'" name="sendinvites" value="'.$mod_strings['LBL_INVITE_PDF'].'" type="button">';
		$button = '<input class="button" onclick="alert(\'ACTION! :)\');" name="sendrs" value="SEND" type="button">';
		return $button; 

Next we create a file in


I am calling it customRSTopButtons.php

I enter the following...

Replace <SUBPANEL NAME> with the name of the subpanel, for example leads_documents_1

    $layout_defs["Leads"]["subpanel_setup"]["<SUBPANEL NAME>"]["top_buttons"] = array(
			//'widget_class' => 'SubPanelTopButtonQuickCreate',
            'widget_class' => 'SubPanelRSendButton',
            'widget_class' => 'SubPanelTopSelectButton',
            'mode' => 'MultiSelect',

Notice I am replacing the quick create button with my custom button we created earlier.

A Quick Repair and Rebuild should do it.
The administrator has disabled public write access.
The following user(s) said Thank You: pgr, robert_sinclair

How to add a Custom Top Button to Any Subpanel 3 years 5 months ago #29722

  • Will
  • Will's Avatar
  • Offline
  • Forum All-Star
  • Where there's a Will, there's a way!
  • Posts: 4242
  • Thank you received: 508
  • Karma: 143
Thank you for this contribution.

I have stickied this topic.


Support the Project - Github Twitter Facebook
Download the latest release: Download SuiteCRM 7.11
The administrator has disabled public write access.
Time to create page: 0.042 seconds
Powered by Kunena Forum