Friday, 27 June 2014

Filter records based on parent module's dropdown field in SugarCRM7.

Filter records based on parent module's dropdown field in SugarCRM7.For example, filter the Contacts module record on the Accounts module's Industry field. Please look at attached screenshot.

(1) create file at custom/Extension/modules/Contacts/Ext/Vardefs/accountIndustryType.php and write the following code into it.

$dictionary['Contact']['fields']['account_industry_type'] = array (
'name' => 'account_industry_type',
'massupdate' => false,
'type' =>'enum',
'options' => 'industry_dom'

(2) Write the following code into custom\modules\Contacts\language\en_us.lang.php

$mod_strings['LBL_ACCOUNT_INDUSTRY_TYPE'] = 'Account Industry Type';

(3) write the following code into fields array of custom/modules/Contacts/clients/base/filters/default/default.php file
'account_industry_type' => array (
'dbFields' =>
array (
0 => 'accounts.industry',
'type' => 'enum',

(4) Do "Quick Repair and Rebuild".

(5) Open Contacts ListView and search on Accounts Industry Type.

Wednesday, 11 June 2014

Disable duplicate check on fields in Sugarcrm 7

Out of some requirements and many requests on forum about how to Disable duplicate check on fields while saving the record.

Lets look at the scenario of what we are trying to achieve. For an example we are taking Contacts module and removing its "First Name" and "Last Name" field from duplicate check.

If you go to the Vardefs file you will see a "duplicate_check" array, within that you need to remove the "first_name" and "Last Name" field from "filter_template" array.
Now lets take a look of how we can do that upgrade-safe way.

Extend the contact's Vardef file at

And then redefine the "filter_template" array in that. See the below example to get more idea.
This will remove the duplicate check on "First Name" and "Last Name" when you try to save contact's record.
$dictionary['Contact']['duplicate_check']['FilterDuplicateCheck']['filter_template'] =
        '$and' => array(
           // array('first_name' => array('$starts' => '$first_name')),
            // array('last_name' => array('$starts' => '$last_name')),
            array('' => array('$equals' => '$account_id')),
            array('dnb_principal_id' => array('$equals' => '$dnb_principal_id')),

After this changes go to Admin -> Repair and perform "Quick Repair and Rebuild". Go back and try saving contact records and check for the duplicates on First Name.

We hope this blog has helped you to some extent. Feel free to ask question or get back to us.


Friday, 6 June 2014

How to add Subpanel top button on SugarCRM 7

This blog will explain in detail how to add a button on Subpanel in SugarCRM 7. We will be adding a “Add Exams” button on Exams Subpanel (Custom module) of Contact detail view.

We will require to extend the View “panel-top” for the module on which you want to add subpanel top button. Create a file at following path  

Copy the code from clients/base/views/panel-top/panel-top.php and paste into panel-top-for-contacts.php file the we just created.

Add the following code in the button array of panel-top-for-contacts.php file.

    'type' => 'examforcontacts',
    'name' => 'select_exam_button',
    'label' => 'LBL_ADD_EXAM',

Create the label in custom/include/language/en_us.lang.php and write the following code into it.
$app_strings['LBL_ADD_EXAM'] = "Add Exams";

We will require to create a field type named as  “examforcontacts”.  For that create custom/clients/base/fields/examforcontacts/examforcontacts.js file and write the logic there for the behavior of the button. For reference you may check the subpanel (Accounts,Contacts etc...) under "Target Lists" module, there is "Select from Reports" button.

Perform "Quick Repair and Rebuild" from Admin -> Repair. And remove browser's cache.

Refresh the Contact’s Detailview and check the subpanel for the button to appear.
Urdhva Tech Pvt. Ltd. Powered by Blogger.

Urdhva Tech

My photo
SugarCRM Consultants Contact us at Skype : urdhvatech

Search This Blog

Stay connected Socially


Total Pageviews

Popular Posts