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

Get date plus or minus today

SugarCRM, SuiteCRM Navin Rakhonde
Several times I have came across same requirement of getting few days back from today, or few days after today. SugarCRM comes with few very handy date utility functions, and there is one which does the job! global $timedate; $today = $timedate->getInstance()->nowDbDate(); // Today $earlier = $timedate->asDbDate($timedate->getNow()->modify("-30 days")); // 30…
Read More

SugarCRM REST API example with javascript

SugarCRM, SuiteCRM Navin Rakhonde
This blog post explains how to login to SugarCRM instance through javascript Let's have an example of REST API through JavaScript. Create an html file to include javascript, We will require jquery. Provide correct Javascript path in HTML file<ANYNAME>.html <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html lang='en'> <head> <meta http-equiv="Content-Type"…
Read More