Duplicate contacts when filtering contacts

In the contact list. When applying a filter some records are repeated. I understand the reason is that the same contact was associated with two accounts. I don’t know how this was done. But I confirm that there are two entries in the accounts_contactos table for the same contact

I read a solution in this answer. Records appear multiple times (duplicated) in listview - #14 by jansiero but it is not working

Could you suggest me a way to resolve this? Greetings and thanks in advance

Hi @mario.martinez
I don’t know why the solution doesn’t work in your case. Are you sure you commented out both account_name and account_id ?

Contacts can be assigned to multiple acounts by opening the detail view of two accounts, opening the subpanel contacts and then on the create button clicking on the arrow-down symbol. This will enable you to select an existing contact.

If it helps you may also remove one relation to an account by

Hi. Thanks for answering. What I tried was to modify the file public/legacy/custom/modules/Contacts/metadata/listviewdefs.php

<?php
$listViewDefs ['Contacts'] = 
array (
  'NAME' => 
  array (
    'width' => '20%',
    'label' => 'LBL_LIST_NAME',
    'link' => true,
    'contextMenu' => 
    array (
      'objectType' => 'sugarPerson',
      'metaData' => 
      array (
        'contact_id' => '{$ID}',
        'module' => 'Contacts',
        'return_action' => 'ListView',
        'contact_name' => '{$FULL_NAME}',
        'parent_id' => '{$ACCOUNT_ID}',
        'parent_name' => '{$ACCOUNT_NAME}',
        'return_module' => 'Contacts',
        'parent_type' => 'Account',
        'notes_parent_type' => 'Account',
      ),
    ),
    'orderBy' => 'name',
    'default' => true,
    'related_fields' => 
    'related_fields' => 
    array (
      0 => 'first_name',
      1 => 'last_name',
      2 => 'salutation',
      // 3 => 'account_name',
      // 4 => 'account_id',
    ),
  ),
// ...

After Repair and Rebuild the duplicate records are still listed in the filtered contact list

Can you identify what I’m doing wrong? The switch is in version 8.5.1 In case it is relevant

Hi @mario.martinez this looks good, however I never tested the solution on SuiteCRM 8 which I still need to adopt. Things might work differently here.

It is possible that it does not work in this version. In any case, thank you very much