2

I have used other contact systems in the past and as well as first_name and middle_name there has been a preferred name field. We have several people who have long first names but they go by a shortened name, additionally we have people who are known by a middle name rather than their first name. What I would like is to display the preferred name as the display name.

2
  • Where are you looking to display the preferred name as the display name? On the contact profile? Emails? Letters?
    – Yossi
    Jan 8 '18 at 3:35
  • On the contact profile and for emails. Jan 8 '18 at 21:06
3

You can change the display name for a contact in 2 ways

  1. By using CiviCRM alter display name hook you can change the Display name to a preferred name.

  2. Update the format for Sort name and/or Display name by navigating to Administer >> Customize Data and Screens >> Display Preference (civicrm/admin/setting/preferences/display?reset=1) and then update the 'Individual Sort Name Format ' and 'Individual Display Name Format' fields as per your choice. (Note: This change will be reflected to contact only if New Individual is added or updated)

HTH

Pradeep

1
  • Thanks for the reply, I am more familiar with MySQl than civi and had manually edited some triggers to test the logic I require. I can see that the hooks are a more robust way to achieve the result I want as my triggers would be overwritten during an upgrade. Jan 8 '18 at 21:12
2

For emails you can do this (considering you are using the Nickname field):

{capture assign=nickname}{contact.nick_name}{/capture}
Dear {if $nickname}{contact.nick_name}{else}{contact.display_name}{/if}
1

Also, there ia a nickname in CiviCRM which you can use for this purpose? There is also a setting that allows you to search on the nickname too.

1
  • Thanks for reply, I have used the nick_name to store the preferred name for this purpose and I will try using Pradeeps's suggestion of a hook to create the preferred display name. Jan 8 '18 at 21:08

This site is temporarily in read only mode and not accepting new answers.

Not the answer you're looking for? Browse other questions tagged .