Adding a middle name to a person's full name

bsoremsugar —  August 27, 2013 — 3 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…

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

  1. 

    Where do you put this function?

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