Archive for 2016
How to disable button in sugarcrm dynamically
Let me explain how to disable button action dynamically thorough controller(ex.record.js) and when our condition meets.
I am creating one button as "Check Button" for Accounts module.
So i am copying record.php from /modules/Accounts/clients/base/views/record/record.php to
custom/modules/Accounts/clients/base/views/record/record.php
Above is the our custom button array to add to Accounts module.I Assume you know how to add button array in record.php
To Add label for custom button , I am creating new file in below path and adding content to that.
/custom/Extension/modules/Accounts/Ext/Language/en_us.check_button.php
Now button is ready.
Now we need to button action in controller file.I know you got what i mean,yes we need to add action for check_button in record.js.
Below is our scenario,
If Account type is customer ,then we should not allow user to edit that record.So we are going to disable "edit" and "check" button when condition meets.
Thats it. Make a repair and rebuild.
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
custom/modules/Accounts/clients/base/layouts/record/record.js
Then copy content from
custom/modules/Accounts/clients/base/layouts/record/record.js
Then save this file
Step 2:
custom/modules/Accounts/clients/base/views/record/record.js
In this file
From above example
't', 'ctrl+alt+t' - shortcut key
Done.