Calls: Related To: more data in list view

Hi all,

I'm trying to extend the Calls List view with new columns:

  • Related Country
  • Related State
  • Related City

Calls List View, with columns of Related To (Country / State / City)

These Data should be pulled by the "Related To" Record if existing. 

Related to can be Lead / Contact / Account or also something else, where no country / state / city info would be available.

In my example I definded the "Related City" like this, but it is limited to related to = contacts:


$dictionary['Call']['fields']['sw_related_city'] = array(
 'name' => 'sw_related_city',
'vname' => 'LBL_SW_RELATED_CITY',
'rname' => 'primary_address_city',
'type' => 'relate',
'id_name' => 'parent_id',
'source' => 'non-db',
'link' => 'contact_parent',
'sort_on' => array('name',),
'module' => 'Contacts',
'table' => 'contacts',
'audited' => true,

I tried to adapt the logic behind the "parent_name" field, but i didn't get something working with that.

Is there a smart solution to get the data of the related record?

Many Thanks and stay healthy


FYI: using SugarCRM v9.0.3 Enterprise - self hosted