AnsweredAssumed Answered

How to obtain SugarBean from a relate field?

Question asked by sonesay inthavong on Mar 22, 2018
Latest reply on Jul 2, 2020 by MichellePang

Hi All


I am working in Cases After Save logic hook and need to get a bean from a relate field. I have a relate field named vehicle_c which is related to a custom module called Vehicle. 


When I log the the field below in sugarlog I seem to get the title of the record but I want to access other fields in the record like VIN  (vin_c).


Any ideas on how I can achieve this?


$GLOBALS['log']->fatal(__METHOD__ . " LOG NAME :::: ".$bean->vehicle_c); // This seems to log name of record.
$GLOBALS['log']->fatal(__METHOD__ . " LOG NAME :::: ".$bean->vehicle_c->id); // This logs nothing