Blogs
June
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 following path.
custom/Extension/modules/Contacts/Ext/Vardefs/duplicate_check_disable.php
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.
<?php
$dictionary['Contact']['duplicate_check']['FilterDuplicateCheck']['filter_template'] = array(
array(
'$and' => array(
// array('first_name' => array('$starts' => '$first_name')),
// array('last_name' => array('$starts' => '$last_name')),
array('accounts.id' => array('$equals' => '$account_id')),
array('dnb_principal_id' => array('$equals' => '$dnb_principal_id')),
)
),
);
Do "Quick Repair and Rebuild".
Go back and try saving contact records and check for the duplicates on First Name.
Comments
- No Comments Found.