Import Duplicate Detection with Related Fields

I had a non-db field added to the duplicate check screen on the import process, but that field no longer displays.  It was made up of the first_name,last_name, and account_name fields.  This no longer appears on the duplicate check dialog.

I then created a non-db index for checking duplicates.

https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_12.0/Data_Framework/Vardefs/Specifying_Custom_Indexes_for_Import_Duplicate_Checking/

But in the SugarBean class (data/SugarBean.php), when fetching indices, it excludes any index that has contains a non-db field (line#1101-ish). I need to check the combination of last_name + first_name + account_name.  Account name is a non-db field, so this method doesn't work.

Do I need to extend the ImportDuplicateCheck (modules/Import/ImportDuplicateCheck.php) class to build this in for contacts, or is there a better way to do this?

Thanks!

  • No idea to solve this at code level but as a sugar admin I would say a workaround is to create a textfield on contacts make a calculated formula that concats the values. This takes about 10 mins effort and you are done :-)

    example:

    concat($last_name, $first_name, related($accounts, "name"))

    If you need spaces inbetween

    concat($last_name, " ", $first_name, " ", related($accounts, "name"))

    Then run recalculate values on all existing records ( if you have more records than the limit for this action allows run a database update via SQL)

    now you have a DB field you can use :-)

    Bests

    Björn 

  • Except this duplicate check is for imports, not existing records.  We'd have to map the account twice, once for the account name and once for the field. Also, you can't map calculated fields in the import wizard.