Body: <p>I have a custom field of an individual that stores the ID of a group (as int). I would like to change the display of the field to show the actual name of the group instead of the ID (same as contact reference functionality).</p>
  
  <p>At the very least I would like to have this done on the contact summary page.</p>
  
  <p>I have tried hook_civicrm_alterContent, but I am unsure how to change the actual displayed field value.</p>
  
  <p><strong>NOTE:</strong> I am able to get it to work by adding some javascript to the hook using jQuery to alter the value. This seems very hacked and getting the proper field is difficult because Civi does not sent distinct ids or classes for the fields being displayed. Something as simple as changing the display order of the fields would break it.</p>
  
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-17T17:30:58.070Z
Comments.Text: In what context do you want to show it? (e.g. in the admin interface?).
Comments.UserDisplayName: Alan Dixon
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-17T20:27:55.090Z
Comments.Text: In this case when a user is viewing a contact's summary page.
Comments.UserDisplayName: Sleewok
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-18T21:42:57.960Z
Comments.Text: I think you would have to create a new custom field type, you could model it on the contact reference field and call it group reference field.
Comments.UserDisplayName: Alan Dixon
Comments.ContentLicense: CC BY-SA 3.0
Comments.CreationDate: 2017-10-24T17:44:37.393Z
Comments.Text: Do you have a link to any documentation on how to do this? Google is not helpful :).
Comments.UserDisplayName: Sleewok
Tags: <custom-fields><hooks><display>
Title: Change displayed value for customfield
ThreadText: # Change displayed value for customfield
  
  (Asked by: username_0 on 2017-10-11)
  
  I have a custom field of an individual that stores the ID of a group (as int). I would like to change the display of the field to show the actual name of the group instead of the ID (same as contact reference functionality).
  
  At the very least I would like to have this done on the contact summary page.
  
  I have tried hook\_civicrm\_alterContent, but I am unsure how to change the actual displayed field value.
  
  **NOTE:** I am able to get it to work by adding some javascript to the hook using jQuery to alter the value. This seems very hacked and getting the proper field is difficult because Civi does not sent distinct ids or classes for the fields being displayed. Something as simple as changing the display order of the fields would break it.
  
  **Tags:** custom-fields, hooks, display
  
  > **Comments:**
  > **username_1**: In what context do you want to show it? (e.g. in the admin interface?).  
  > **username_0**: In this case when a user is viewing a contact's summary page.  
  > **username_1**: I think you would have to create a new custom field type, you could model it on the contact reference field and call it group reference field.  
  > **username_0**: Do you have a link to any documentation on how to do this? Google is not helpful :).  
  
  ---
  
  ## 0 answers
  
  