Adding a middle name to a person's full name

Sugar Dev Team —  August 27, 2013 — 8 Comments

Sugar out of the box has all the basic pieces for a person’s name; first name, last name, and salutation. But what if you need to add a person’s middle name, or perhaps a suffix field? You can add the custom fields in easily enough, but then how can you ensure the full name display has all of these pieces properly together?

Here’s two ways you could do it. First, leveraging Sugar Logic, you could build a formula like this on the name and full_name fields…

concat($salutation," ",$first_name," ",$middle_name_c," ",$last_name," ",$suffix_c)

Another option is you could do is override the _create_proper_name_field() method in that specific module’s bean class to include in the $middle_name_c and $suffix_c fields in the method. See below for an example on how this could work…

8 responses to Adding a middle name to a person's full name

  1. 

    Where do you put this function?

  2. 

    Is this working? i tried it but doesnt work

    • 

      The Sugar Logic way or the custom function? The Sugar Logic way should still work in Sugar 7. Also make sure you’ve created the custom fields identified for Middle Name, etc.

      • 
        Longki Dela Cruz February 20, 2016 at 5:21 am

        The custom function sir. The middle name is showing in activity stream but not in detail and editview. And is there a way to insert the custom middle_name_c field in between the first_name and last_name? in all views?

      • 

        For the Sugar Logic, where should i put the concat code? will the field middle name appear in Contacts?

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s