In my organization we have specific needs with the search for activities. In the activity search results we want to show the results of the "With" column first the First Name and then the Last Name and currently we have it the other way around.

It is possible to modify the order of how the name is displayed in the activity search results column?

enter image description here

1 Answer 1


Depends on what you want exactly. You can define the way in which the display name and sort name are constructed in Administer>Customize Data and Screens>Display Preferences. But that will affect the way it is built up all over the system, not just in the activity search. And this is typically a setting you configure at the start of your CiviCRM usage. It does not update all the existing contacts automatically if you change the settings, just do it differently when you change a contact.

The other alternative would be to customize the activity search programmatically to adjust the display name only on the activity search.

  • As I said in my question, I specifically need it to work in the "With" column in the activity search results. It might be possible to edit the code of some file but I don't know which one. Dec 1, 2023 at 8:55
  • 1
    Have you checked the CiviCRM Developer Guide? docs.civicrm.org/dev/en/latest? It is a little more than just editing a file :-) What you could do is create your own activity search using Search Kit, check the chapter in the Developer Guide. Dec 1, 2023 at 13:28
  • You're misplaced since the documentation talks about Hooks as a possible solution, however, if there are variables in PHP functions that show the short name, you can surely put "First name and then last name", BUT I STILL CAN'T FIND A WAY. Dec 1, 2023 at 19:02
  • I am sorry you can not find a way but I would prefer you not to shout to me? The CiviCRM community consists of volunteers and shouting at us is not appreciated. CiviCRM is a large and functionally rich bit of software and if you want to change the sequence programmatically you will have to check how to write an extension. As stated, the alternative is to create your own activity search using Search Kit, there is a chapter on that in the Developer Guide too. Good luck! Dec 4, 2023 at 8:05

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.