SugarCRM 7 — Adding an action to the listview headerpanel

Shane Dowling
Jul 25, 2015 · 2 min read
Image for post
Image for post

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 tutorial
with a few changes to how the button gets rendered and the actions get
called.

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.

<?php
if(!defined('sugarEntry') || !sugarEntry) die('Not A Valid Entry Point');

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

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!

Extra tip.

Only want to do this for a single module. Instead of placing the code in
custom/clients place it in custom/modules/<MODULE>/clients and it
should work for just that one module.

Tech Blog

Random smattering of technical posts

Medium is an open platform where 170 million readers come to find insightful and dynamic thinking. Here, expert and undiscovered voices alike dive into the heart of any topic and bring new ideas to the surface. Learn more

Follow the writers, publications, and topics that matter to you, and you’ll see them on your homepage and in your inbox. Explore

If you have a story to tell, knowledge to share, or a perspective to offer — welcome home. It’s easy and free to post your thinking on any topic. Write on Medium

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store