This tutorial should show you how to add a custom button/action that
will appear across all modules. It's a little similar to this
with a few changes to how the button gets rendered and the actions get
1. Adding the button to the headerpanel
Firstly you'll need to create a new folder to store the headerpane
actions, so create this folder in the sugarcrm root
directory custom/clients/base/views/list-headerpane/. Then create the
file list-headerpane.php with this content. This will add a button next
to the Create button for all modules.
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');
* Your installation or use of this SugarCRM file is subject to the applicable
* terms available at
* If you do not agree to all of the applicable terms or do not have the
* authority to bind the entity as an authorized representative, then do not
* install or use this SugarCRM file.
* Copyright (C) SugarCRM Inc. All rights reserved.
$viewdefs['base']['view']['list-headerpane'] = array(
'template' => 'headerpane',
'title' => 'LBL_MODULE_NAME',
'buttons' => array(
'name' => 'new_button',
'type' => 'button',
'label' => 'LBL_NEW_BUTTON_LABEL',
'css_class' => 'btn-secondary',
'acl_action' => 'list',
'events' => array(
'click' => 'list:new_button:fire'
'name' => 'create_button',
'type' => 'button',
'label' => 'LBL_CREATE_BUTTON_LABEL',
'css_class' => 'btn-primary',
'acl_action' => 'create',
'route' => array(
'name' => 'sidebar_toggle',
'type' => 'sidebartoggle',
2. Adding the action hook
To fire this action you'll need to add some
code custom/clients/base/views/recordlist/recordlist.js, in the
initialize function add a line like this:
this.context.on('list:new_button:fire', this.applyFxn, this);
Now populate applyFxn with whatever code you want to run and it will
work across every module.
3. Quick Repair and Rebuilt(as always)
Any questions feel free to ask!
Only want to do this for a single module. Instead of placing the code in
custom/clients place it in custom/modules/<MODULE_NAME>/clients and it
should work for just that one module.