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

Show message after redirection

SugarCRM, SuiteCRM Navin Rakhonde
Let's alert user a message after redirection to any view. Following piece of code will show a message at the top of the view you have redirected user to. SugarApplication::appendErrorMessage('You have been redirected here because ....'); If you dont know how to redirect user to a certain view, SugarApplication::redirect('index.php?module=<MODULE_NAME>&action=<ACTION>&record=<RECORD_ID>'); After…
Read More

Dealing with multienums with SugarCRM

SugarCRM, SuiteCRM Navin Rakhonde
SugarCRM comes with a very handful function to convert multi enum values from ^value_1^,^value_2^,^value_3^,^value_4^ into an array. $aField = unencodeMultienum($fieldValue); var_dump($aField); will give you an array. In the same manner the reverse is possible. Give an array of values which will be converted into a string which SugarCRM understands. encodeMultienumValue($arr);…
Read More