Related Field - Search

Hi all,

I extended the Calls module by a ID field pae_contact_id, linked to the Contacts Module. (see code below of the pae_vardef)

Additional I want to display & search the Contact Name and Country in the Calls List View.

Displaying the data works, but when trying to search the Country, I just get a list of all Contacts to filter on a single Contact:

What do I need to change to be able to search for e.g. all Calls where the Contact Country is "DE"

Many thanks for your help :)

Sven

// custom/Extension/modules/Calls/Ext/Vardefs/pae_vardefs.php 

$dictionary['Call']['fields']['pae_contact_id'] = array(
    'name' => 'pae_contact_id',
    'vname' => 'LBL_PAE_CONTACT_ID',
    'type' => 'id',
);

$dictionary['Call']['fields']['pae_contact_name'] = array(
    'name' => 'pae_contact_name',
    'vname' => 'LBL_PAE_CONTACT_NAME',
    'rname' => 'name',
    'type' => 'relate',
    'id_name' => 'pae_contact_id',
    'source' => 'non-db',
    'link' => 'pae_contact_link',
    'sort_on' => array('name',),
    'module' => 'Contacts',
    'table' => 'contacts',
    'audited' => true,
);

$dictionary['Call']['fields']['pae_contact_country'] = array(
    'name' => 'pae_contact_country',
    'vname' => 'LBL_PAE_CONTACT_COUNTRY',
    'rname' => 'primary_address_country',
    'type' => 'relate',
    'id_name' => 'pae_contact_id',
    'source' => 'non-db',
    'link' => 'pae_contact_link',
    'sort_on' => array('name',),
    'module' => 'Contacts',
    'table' => 'contacts',
    'audited' => true,
    'readonly' => true,
);


$dictionary['Call']['fields']['pae_contact_link'] = array(
    'name' => 'pae_contact_link',
    'type' => 'link',
    'relationship' => 'pae_rel_contact',
    'vname' => 'LBL_PAE_CONTACT_NAME',
    'source' => 'non-db',
);

$dictionary['Call']['relationships']['pae_rel_contact'] = array(
    'lhs_module' => 'Contacts',
    'lhs_table' => 'contacts',
    'lhs_key' => 'id',
    'rhs_module' => 'Calls',
    'rhs_table' => 'calls',
    'rhs_key' => 'pae_contact_id',
    'relationship_type' => 'one-to-many',
);

Parents Reply Children
  • Hi Poojitha,

    Thanks for your help, I read these documents, but I think you got me wrong.

    When clicking on this filter on Calls List View:

    I get this Search and Select, with all Contacts listed and can select one or multiple Contacts, whose calls are then shown in the Calls List view.

    But I would like to have the Countries selectable there, like in the Contacts List View, and then get all Calls where the Contacts are in the specified countries.