How do I add additional columns to Convert Lead page that shows existing Contacts that might match?

How do I add additional columns to the page that says:

The contact record you are about to create might be a duplicate of an contact record that already exists. Contacts records containing similar names are listed below.
Click Create Contacts to continue creating this new contact, or select an existing contact listed below.
This page appears when trying to convert leads to contacts.

In addition to the correct answer.

The following needs to be done to complete the column labels:

In file ./custom/modules/Leads/language/en_us.lang.php there is an array of $mod_strings.  The following needs to be added for each column.

Database field name(or alias given in query) = {field name}, example: primary_address_city.

'db_{field name}' => 'LBL_LIST_{FIELD NAME}',

'LBL_LIST_{FIELD NAME' => '{label for field name in english',

Example of Primary City:

'db_primary_address_city' => 'LBL_LIST_PRIMARY_ADDRESS_CITY',

'LBL_LIST_PRIMARY_ADDRESS_CITY' => 'City',

Parents
  • Amy Cox,

    Great question. This took me a while to track down! I got it to put the Primary Address City instead of the title, but you will have to play with some joins to get anything interesting to appear --- like email or account name or anything like that -- but I didn't play with it long enough to get the label in the header of the table. 

    In the file modules/Contacts/ContactFormBase.php I made the changes to the query string in line 65 [I highlighted my changes for you]

    /**

    * getDuplicateQuery

    *

    * This function returns the SQL String used for initial duplicate Contacts check

    *

    * @see checkForDuplicates (method), ContactFormBase.php, LeadFormBase.php, ProspectFormBase.php

    * @param $focus sugarbean

    * @param $prefix String value of prefix that may be present in $_POST variables

    * @return SQL String of the query that should be used for the initial duplicate lookup check

    */

    public function getDuplicateQuery($focus, $prefix='')

    {

      $query = 'SELECT contacts.id, contacts.first_name, contacts.last_name, contacts.primary_address_city FROM contacts ';

        // Bug #46427 : Records from other Teams shown on Potential Duplicate Contacts screen during Lead Conversion

        // add team security

        $query .= ' where contacts.deleted = 0 AND ';

      if(isset($_POST[$prefix.'first_name']) && strlen($_POST[$prefix.'first_name']) != 0 && isset($_POST[$prefix.'last_name']) && strlen($_POST[$prefix.'last_name']) != 0){

      $query .= " contacts.first_name LIKE '". $_POST[$prefix.'first_name'] . "%' AND contacts.last_name = '". $_POST[$prefix.'last_name'] ."'";

      } else {

      $query .= " contacts.last_name = '". $_POST[$prefix.'last_name'] ."'";

      }

      if(!empty($_POST[$prefix.'record'])) {

      $query .= " AND  contacts.id != '". $_POST[$prefix.'record'] ."'";

      }

        return $query;

    }

    Hope this helps

  • Thank you for your response. 

    I really need to do this in a custom folder though, so that it will be upgrade safe.

    I am starting to wonder if there is a way to do that in the custom folder.

  • I have it . . . Just need to finish testing and will respond with the answer soon.

Reply Children
No Data