Mark a field Required only for new records

SugarCRM, SuiteCRM Navin Rakhonde
How to make a field mandatory only if creating a record? For example lets make "Office phone" required Lets do this, Steps are as below, 1.Add a reference to the JavaScript file which will be needed for event binding. Path: custom/modules/<desired_module>/metadata/editviewdefs.php <?php $viewdefs['<desired_module>']['EditView']['templateMeta']['includes'] = array ( array ( 'file' => 'custom/modules/<desired_module>/js/editview.js', ), );…
Read More

Dropdown values in customCode

SugarCRM, SuiteCRM Navin Rakhonde
Came across an interesting question which led me to check and write a blog post. Translate enum value to display in customCode It is a two step solution. Step 1: Create / Edit custom/modules/Accounts/view.detail.php add following code in function display. function display(){ global $app_list_strings; $this->ss->assign('APP_LIST', $app_list_strings); // ...... // ......…
Read More

Make an Edit View field Read Only based on User Role

SugarCRM, SuiteCRM Navin Rakhonde
Make Work Phone read-only of a Contact for certain role users! Steps are as below, Step 1: As it is SugarCRM's module, copy modules/Contacts/views/view.edit.php to custom/modules/Contacts/views/view.edit.php or edit if it already exists at custom/modules/Contacts/views/view.edit.php In function display() add following piece. function display(){ // add this if function display doesn't exist…
Read More

Accessing PHP variable in .tpl

SugarCRM, SuiteCRM Navin Rakhonde
Sometimes situation may arise when you want some PHP code in tpl. Following piece of code will show how to achieve this. {php} global $current_user; $this->_tpl_vars['current_user_email'] = $current_user->email1; {/php} Now use 'current_user_email' variable as follows in tpl. <input type="text" id = "current_user_email" name="current_user_email" value='{$current_user_email}'> Hope you find this blog post helpful.…
Read More