Skip to content

Instantly share code, notes, and snippets.

Last active December 14, 2015 15:35
What would you like to do?
Adding a custom button to Sugar 7 Accounts Record view using metadata
* Copyright 2015 SugarCRM Inc. Licensed by SugarCRM under the Apache 2.0 license.
//Insert our custom button definition into existing Buttons array before the sidebar toggle button
array_splice($viewdefs['Accounts']['base']['view']['record']['buttons'], -1, 0, array(
'name' => 'custom_button',
'type' => 'button',
'label' => 'My Custom Button',
'css_class' => 'btn-link',
//Set target object for Sidecar Event.
//By default, button events are triggered on current Context but can optionally set target to 'view' or 'layout'
//'target' => 'context'
'events' => array(
// custom Sidecar Event to trigger on click. Event name can be anything you want.
'click' => 'button:custom_button:click',
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment