Date Category SuiteCRM

It’s possible to add your own action menu items to the List view. By the end of this post you’ll be able to add your own menu items like this one:

Custom List View
Button In our case we’ll be adding this to the “Calls” list view.

First off we add the string for the menu item text. In this case “New action”. We place this into `custom/Extension/modules/Calls/Ext/Language/en_us.CustomMenuAction.php` (the `CustomMenuAction` part can be anything you like.

<?php
$mod_strings['LBL_NEW_ACTION'] = 'New action';

Next we create a new custom list view for the calls module and place this in `custom/modules/Calls/views/view.list.php` (customising views can be found in my SuiteCRM book).

<?php
require_once 'modules/Calls/views/view.list.php';

class CustomCallsViewList extends CallsViewList{

    public function preDisplay(){
        parent::preDisplay();
        $this->lv->actionsMenuExtraItems[] = $this->getNewActionMenuItem();
    }

    private function getNewActionMenuItem(){
        global $mod_strings;
        return <<<EOF
        <a href='javascript:void(0)'
        onclick="return sListView.send_form(true, 'Calls', 'index.php?entryPoint=myNewEntryPoint','Please select at least 1 record to proceed.')">
            {$mod_strings['LBL_NEW_ACTION']}
        </a>";
EOF;
    }
}

This does the actual work of adding the button. This adds a new bit of HTML to the array `\$this->lv->actionsMenuExtraItems`. SuiteCRM will then pick this up and add this to the list of action buttons.

In this case the button just points to a new entry point `myNewEntryPoint`. Adding entry points will be covered in a future post (if you are impatient you can always checkout my SuiteCRM book).