how to create hook to retrieve a column and display on record view

I am trying to create a hook that will retrieve the relevant column I want to display when selecting a relate field. By default this brings a back and stored the id in the custom table. I want to bring back a column related to this custom table

in my module vardefs added 


'newcol'=>[
'name' => 'newcol',
'type' => 'varchar',
'source' => 'non-db',
'len' => '255',
'vname' => 'LBL_NEWCOL',
],



I followed this to create the hook https://support.sugarcrm.com/Documentation/Sugar_Developer/Sugar_Developer_Guide_10.3/Architecture/Logic_Hooks/Module_Hooks/after_retrieve/

Problem is I do not see the new field to select and display on record view. And how would I make sure it relates to on change/type/select of my drop down?
Parents
  • By default the Relate field displays the "name" field and stores the "id" as the foreign key in the record.

    If you are trying to change what is displayed to the user to choose the record you can use the rname.

    For example, in a relate field to Cases, let's call this relate field "case_c" you might want to display the Case Number instead of the Case's Name in the field.

    By setting the rname in your module's Extension framework dictionary you will achieve that goal (
    where "YourModule" is the name of the module that includes the case_c field):

    $dictionary['YourModule']['fields']['case_c']['rname']='case_number';

    custom/Extension/modules/YourModule/Ext/Vardefs/yourfilename.php

    Is that what you are trying to do?

Reply
  • By default the Relate field displays the "name" field and stores the "id" as the foreign key in the record.

    If you are trying to change what is displayed to the user to choose the record you can use the rname.

    For example, in a relate field to Cases, let's call this relate field "case_c" you might want to display the Case Number instead of the Case's Name in the field.

    By setting the rname in your module's Extension framework dictionary you will achieve that goal (
    where "YourModule" is the name of the module that includes the case_c field):

    $dictionary['YourModule']['fields']['case_c']['rname']='case_number';

    custom/Extension/modules/YourModule/Ext/Vardefs/yourfilename.php

    Is that what you are trying to do?

Children
No Data