display contact data in custom list view

I created a new module that has a many-to-one relationship with Contact.  This module is intended to record the office visits for a contact.
In the Office Visit list view, I would like to display additional fields from the contact for example, birthdate.  The list view is already displaying the concatenated contact name along with fields from the Office Visit table but I cannot figure out how to add additional contact fields. 

I am using SugarCRM 6.5.24 (CE)

My module is called HBF01_Initial_Exam

I added birthdate to custom/extension/modules/HBF01_Initial_Exam/Ext/Vardefs/hbf01_initial_exam_contacts_1_HBF01_Initial_Exam.php

<?php
// created: 2017-02-28 16:02:29
$dictionary["HBF01_Initial_Exam"]["fields"]["hbf01_initial_exam_contacts_1"] = array (
  'name' => 'hbf01_initial_exam_contacts_1',
  'type' => 'link',
  'relationship' => 'hbf01_initial_exam_contacts_1',
  'source' => 'non-db',
  'module' => 'Contacts',
  'bean_name' => 'Contact',
  'vname' => 'LBL_HBF01_INITIAL_EXAM_CONTACTS_1_FROM_CONTACTS_TITLE',
  'id_name' => 'hbf01_initial_exam_contacts_1contacts_ida',
);
$dictionary["HBF01_Initial_Exam"]["fields"]["hbf01_initial_exam_contacts_name"] = array (
  'name' => 'hbf01_initial_exam_contacts_name',
  'type' => 'relate',
  'source' => 'non-db',
  'vname' => 'LBL_HBF01_INITIAL_EXAM_CONTACTS_1_FROM_CONTACTS_TITLE',
  'save' => true,
  'id_name' => 'hbf01_initial_exam_contacts_1contacts_ida',
  'link' => 'hbf01_initial_exam_contacts_1',
  'table' => 'contacts',
  'module' => 'Contacts',
  'rname' => 'name',
  'db_concat_fields' =>
  array (
    0 => 'first_name',
    1 => 'last_name'
  ),
);
$dictionary["HBF01_Initial_Exam"]["fields"]["birthdate"] = array (
  'name' => 'birthdate',
  'type' => 'date',
  'source' => 'non-db',
);
$dictionary["HBF01_Initial_Exam"]["fields"]["hbf01_initial_exam_contacts_1contacts_ida"] = array (
  'name' => 'hbf01_initial_exam_contacts_1contacts_ida',
  'type' => 'link',
  'relationship' => 'hbf01_initial_exam_contacts_1',
  'source' => 'non-db',
  'reportable' => false,
  'side' => 'right',
  'vname' => 'LBL_HBF01_INITIAL_EXAM_CONTACTS_1_FROM_INITIAL_EXAM_TITLE',
);

I also tried adding birthdate to htdocs/modules/HBF01_Initial_EXAM/vardefs.php.  The label is added to the list view but the data is always empty.

This is what I see in the SugarCRM.log

07/08/17 18:39:55 [5188][1][DEBUG] SugarBean[HBF01_Initial_Exam].load_relationships, Loading relationship (hbf01_initial_exam_contacts_1).
07/08/17 18:39:55 [5188][1][DEBUG] Limit Query: SELECT  hbf01_initial_exam.id ,hbf01_initial_exam_cstm.appt_ttime_c,hbf01_initial_exam_cstm.arrival_time_c,
hbf01_initial_exam_cstm.clinic_loc_c , LTRIM(RTRIM(CONCAT(IFNULL(jt0.first_name,''),' ',IFNULL(jt0.last_name,'')))) hbf01_initial_exam_contacts_name, jtl0.hbf01_initial_exam_contacts_1contacts_ida hbf01_initial_exam_contacts_1contacts_ida, hbf01_initial_exam.status , hbf01_initial_exam.assigned_user_id  FROM hbf01_initial_exam  LEFT JOIN hbf01_initial_exam_cstm ON hbf01_initial_exam.id = hbf01_initial_exam_cstm.id_c   LEFT JOIN  hbf01_initial_exam_contacts_1_c jtl0 ON hbf01_initial_exam.id=jtl0.hbf01_initial_exam_contacts_1hbf01_initial_exam_idb AND jtl0.deleted=0
 LEFT JOIN  contacts jt0 ON jt0.id=jtl0.hbf01_initial_exam_contacts_1contacts_ida AND jt0.deleted=0
 AND jt0.deleted=0 where hbf01_initial_exam.deleted=0 ORDER BY birthdate ASC Start: 0 count: 21

Your help is greatly appreciated.

Parents
  • Hi Jennifer Crisman 

    In order to populate records on a list (ListView, List Dashlet or Subpanel) you need to implement a logic hook process_record.

    Kind regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Can you see any error at either php_error.log or apache error.log?

    Regards

    André Lopes
    Lampada Global
    Skype: andre.lampada
  • Yes in apache error.log

    [:error] [pid 5188:tid 1312] [client ::1:59946] PHP Parse error:  syntax error, unexpected 'class' (T_CLASS) in C:\\BitNami\\sugarcrm-6.5.12-0\\apps\\sugarcrm\\htdocs\\custom\\modules\\HBF01_Initial_Exam\\logic_hooks_class.php on line 4, referer: http://localhost/sugarcrm/index.php?action=ajaxui

  • I copied the content of your logic_hooks_class.php, saved it into a local file and executed it without big deal.

    Can you kindly attach such file so we can properly test it?

    Please attache the file logic_hooks.php as well.

    André Lopes
    Lampada Global
    Skype: andre.lampada
Reply
  • I copied the content of your logic_hooks_class.php, saved it into a local file and executed it without big deal.

    Can you kindly attach such file so we can properly test it?

    Please attache the file logic_hooks.php as well.

    André Lopes
    Lampada Global
    Skype: andre.lampada
Children