Add a custom action in SugarCRM 7

By
467 views

In SugarCRM 7, custom actions cannot be added for sidecar modules. You will need to create layout and view for a custom action . To retrieve/save on that view/layout, a REST API call is used.

To setup a custom layout e.g ‘my-view’
create a php file ./custom/clients/base/layouts/setup/setup.php to render a custom view named “my-view”.
<!–?php

$viewdefs[‘base’][‘layout’][‘setup’] = array(
‘type’ => ‘simple’,
‘components’ => array(
array(
‘view’ => ‘my-view’,
),
),
);

Creating a custom View:

A custom view helps render the content that is to be viewed. The javascript controller defines how the page should be rendered. This is defined in ‘ ./custom/clients/base/views/my-view/my-view.js ‘

({
className: ‘setup tcenter’,

loadData: function (options) {
this.render();
}
})

A handlebars template is then created to show the result in ‘./custom/clients/base/views/my-view/my-view.hbs’
{

My View!!

}
To see your newly created layout and view, you will navigate to:

//{site url}/#/layout/setup

Custom API:
To generate the data required, we can create a custom REST API by extending Sugar 7’s REST API.

Need Help? Get Free Consultation


captcha

Please leave this field empty.

Get in touch



captcha

Please leave this field empty.

Contact Information