Archive for January 2016

Creating custom keyboard shortcuts in sugarcrm


Let me say something about shortcut keyboard in sugarcrm,How it can be done.
Here is sample, Open any record in any module.And press "e".

Now you will be able to see the edit view of that record. like the same

To Save a record ,press "ctrl+s" or "ctrl+alt+a"

To Edit a record press "e" or "ctrl+alt+i"

To Cancel a edit view press "esc" or "ctrl+alt+l"

To Go to next record press "l"

To Go to previous record press "h"

To Get more action button press "m"

These all are default sugar shortcut keys.yes .Its interesting.Then why cant we try creating/registering our shortcut key.

Let we try to create our custom shortcut key.

Steps:

Step 1:

Create file record.js in below path

custom/modules/{module-name}/clients/base/layouts/record/record.js

ex.
custom/modules/Accounts/clients/base/layouts/record/record.js

Then copy content from

clients/base/layouts/record/record.js

and paste it to this file.

Then add our shortcut name at end of this file ( bold values are our shortcut key name)

custom/modules/Accounts/clients/base/layouts/record/record.js

Then save this file

Step 2:

custom/module/{module-name}/clients/base/views/record/record.js

ex
custom/modules/Accounts/clients/base/views/record/record.js

In this file

override registerShortcuts() function and add our functionality for shortcut key.

Example:

Here i am trying click test button by shortcut key ( f and ctrl+alt+f).

From above example

Record:Test - name of shortcut key and view ( this should match with which we added in layout/record.js)

't', 'ctrl+alt+t' - shortcut key

name=test_button - this is my button.Note my button will come in more action in record view.

Done.

Then make quick repair and rebuild.


- Copyright © SugarCRM Blog - Ajay Kumar - Powered by Blogger - Designed by Ajay Kumar -