add duplicate email column to duplicate check on lead save

When saving a new lead and there is another lead with the same email, i get the Duplicate screen, with a table of the leads that have the same email. but the email column is not shown - only the first name, last name and title and the headline doesn't tell that the duplicate is an email , only that there are duplicates.

how can i show the email column in the duplicates table?

working with sugarcrm CE 6.5.24 and  code change doesn't have to be upgrade safe.

  • Hi Asaf Army,

    I do not have a complete process available for you, but I took a look at stock CE 6.5.24 files.

    It appears that the fields in that list derive at least in part from the following file:

    modules/Leads/views/view.showduplicates.php

     

    This file contains the following database query:

    $query = 'SELECT id, first_name, last_name, title FROM leads WHERE deleted=0 ';

     

    Changing the displayed fields might include needing to change this database query. It might require other changes as well.

     

    I am not a CE user so I am not sure how the email address field work in CE, but I know in subscription editions (Pro, Ent, etc) the email address functions more like a related module with it own table and relationship tables. A manual rewrite of the above query for use in a subscription edition might look something like the following:

    $query = 'SELECT leads.id, leads.first_name, leads.last_name, leads.title, email_addresses.email_address FROM leads 
    JOIN email_addr_bean_rel ON leads.id = email_addr_bean_rel.bean_id
    JOIN email_addresses ON email_addr_bean_rel.email_address_id = email_addresses.id
    WHERE leads.deleted=0 '
    ;

    This query might be entirely irrelevant to solving this same use case in a subscription edition. The query is just being shown here as a query that would work in a subscription edition's database to get the information including email address, regardless of use case.

    I hope this helps in your investigation of how to achieve your goal.

  • Hi Asaf Army,

    Please do the following:

    1. Add Leads/save.php to custom folder.
    2. Add 'LeadFormBase.php' to custom folder and override the 'getDuplicateQuery'.
    3. Include the email address in the duplicate query (make sure to add only email address which is a duplicate or else you will end up having multiple records of same lead in the table).


    Kind Regards,
    Rolustech Support
    Email: support@rolustech.com
    Website: www.rolustech.com

  • Thank you so much!

    i think both the above solutions are needed:

    Patrick solution is needed for the "background" duplicate check

    and Rolustech solution is needed for the table to show the results...

    i'll implement it and make an update....

    Thank you!

  • Hi Rolustech Support,

    Thanks for the information. It was very helpful and I was able to add new fields to the duplicate check. What I cannot figure out is hold to update the titles line to add my new fields to there? Any idea which file needs to be modified for that?

    Thanks,

    Dianna

  • Hi Diana,

    To add the field in duplicate check, you can refer to the thread (Rolustech old comment).

    To update the title( I am assuming the column table header) of the newly added field in duplicate checklist view, do following steps(e.g, your new field name is new_field)
    1. Create a language file at path custom/Extension/modules/Leads/Ext/Language/en_us.duplicate_check_list_column.php
    2. Define the following labels in this file
    <?php
    // Replace new_field with actual field name.
    $mod_strings['db_new_field'] = 'LBL_LIST_NEW_FIELD';
    $mod_strings['LBL_LIST_NEW_FIELD'] = 'New Field'; // In case label is already define, no need to write this line.
    ?>
    Kind Regards,
    Rolustech Support
    Email: support@rolustech.com
    Website: www.rolustech.com
  • Rolustech Support,

    Thanks so much for the assistance. I searched for quite some time for a solution.

    Thanks again,

    Dianna