How to add JavaScript file in editview or detailview for any module in SugarCRM / SuiteCRM

SugarCRM, SuiteCRM Navin Rakhonde
It will be done by below steps only! Lets do this, STEP 1 : Add a reference to the JavaScript file which will be needed for event binding. Path for Edit View: custom/modules/<desired_module>/metadata/editviewdefs.php <?php $viewdefs['<desired_module>']['EditView']['templateMeta']['includes'] = array ( array ( 'file' => 'custom/modules/<desired_module>/js/editview.js', ), ); ?> Path for Detail View: custom/modules/<desired_module>/metadata/detailviewdefs.php <?php $viewdefs['<desired_module>']['DetialView']['templateMeta']['includes']…
Read More

How to call JavaScript function from editviewdefs field of any module in SugarCRM / SuiteCRM

SugarCRM, SuiteCRM Navin Rakhonde
It will be done by below steps only! Lets do this, STEP 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', ), ); ?> Step 2 : Add the JavaScript file you…
Read More

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

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

Getting dropdown options in Javascript

SugarCRM, SuiteCRM Navin Rakhonde
At times, We have ran into requirement of getting drop down options of a field in Javascript in SugarCRM. Here is the code that will get you options as an array. For example, you want to fetch values of case_status_dom, the code will be, var statusOptions = SUGAR.language.languages.app_list_strings['case_status_dom']; alert(statusOptions['Closed']); //…
Read More