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.
3 Answers
You can change the display name for a contact in 2 ways
By using CiviCRM alter display name hook you can change the Display name to a preferred name.
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
-
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, 2018 at 21:12
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}
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.
-
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, 2018 at 21:08