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 

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

I followed this to create the hook

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?
  • I am not entirely sure I understand what it is you are trying to accomplish, however, it is worth mentioning that logic hooks aren't intended to interact with the UI. They are intended to be used on the backend, for processes such as manipulating data upon retrieval, save or deletes. 

    If you are wanting to create some sort of dynamic UI/view, your best options are to use dependencies, SugarLogic and/or custom view controllers.

    If you elaborate on what exactly it is you are trying to accomplish, I might be able to provide you more precise assistance.

  • 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):



    Is that what you are trying to do?