No announcement yet.

Addition of "Middle Name"

  • Filter
  • Time
  • Show
Clear All
new posts

  • Addition of "Middle Name"

    Are there plans to add a Middle Name, or Middle Initial, to the Contacts information? Many times you will have multiple people in your contacts not assigned to a specific account just yet and having a middle initial would make it easier to identify the correct contact without having to open these contacts to see who is who. Also some people like to be addressed using their middle name, middle initial, so this would be helpful.


  • #2
    Hello, you could use for the name-field the fields firstName and lastName instead of name (what forms a fieldgroup of first and last name). Then you can create a custom field middleName.


    • #3
      Thanks. I'm fairly new to ESPOCRM, but will look into this option.


      • #4
        Any progress on this? Several languages, such as German and Dutch, use middle names very commonly. For example, "Jan van der Berg", where "Jan" is first name, "van der" middle and "Berg" last name. We can not use lastName field with "van der Berg" as the searching and sorting would be wrong. Of course we can not use firstName field as "Dear Jan van der," would look absurd in automated emails..

        So, we added "middleName" field. That can work, but now the combined "Name" Espo often display, is not using the middleName, e.g. we see "Jan Berg" which is wrong for sure.

        Basically we need: Name = firstName + " " + middleName + if(middleName<>'""," ","") + last Name

        See also
        Last edited by TomV; 12-12-2018, 04:18 PM.


        • #5
          Middle name is now supported in v5.8.

          To use it, you need to Admin > Settings > Person Format Name > "First Middle Last name".

          After that there will be a "Middle Name" box display when you edit/create contact.


          • #6

            Hey, I have customized the application/Espo/Core/Utils/Database/Orm/Fields/PersonName.php to support FirstMiddleLastSuffix name.

            But i am facing a different problem after upgrade from 5.9.4 to 6.0.9, that is when a lead is created manually from the form the middle name is not getting saved in the Database.
            Fetch of espocrm/client/custom/src/views/fields/person-name.js is working fine. One middle name is fetched and page refresh the value will vanish.
            I tried to debug and found that,
            espocrm/application/Espo/Core/Controllers/Record.php file has function actionCreate() which had data which does contain middleName. But for the save action this function is called twice. So second time when the function is called the data does not contain middleName.

            Can you please help me out in this?
            Last edited by Ananya K; 01-12-2021, 11:30 AM.


            • #7
              Sorry can't help, out of my knowledge. My suggestion would just be delete your custom edit. Why did you need to add this edit by the way if EspoCRM already support MiddleName?

              If you remove your create Middlename field I believe EspoCRM would generate the default MiddleName field as a replace (do test it first before going All In though).

              And your name order seem to be quite standard, First Middle Last is normal (I use it too), but there is this Suffix at the end, I'm not sure what that is but it probably the reason why you get an error? But when it come to fetching data it would be fetching/converting it would be field by field, the information that it display shouldn't affect anything.

              What I'm saying is all speculation though, don't really know how accurate it is. If you can modify code, chances are you are more skilled than me.

              PS: I'm just a user, not part of EspoCRM's team or have any coding skill at all.


              • #8
                espcrm Hey no problem. Thank you very much for your input.
                Actually problem was with the role. The roles for the user was not allowing the user to set the middle name. So, i updated the user roles and it worked for me. Since the ORM improvisation in the latest release all these minor bugs are fixed.

                And coming to the name format,

                My requirement:
                First Name: John
                Middle Name : K
                Last Name: Smith
                Suffix Name : Jr

                Name : John K Smith Jr

                So I Customized the person-name. And its working perfectly fine.
                Attached Files
                Last edited by Ananya K; 01-18-2021, 09:27 AM.


                • espcrm
                  espcrm commented
                  Editing a comment
                  That cool having suffix there and glad you fixed it.

                  Personally it is quite rare for me to run into anyone with a suffix name and I tend to just use first name for that. But it be good if you can share how you did that for other.

              • #9
                Customizing the Person Name Field View: (For Espocrm Version 6.0.9)

                I have created following set of custom files to override the Espocrm Person name format.

                1. espocrm/custom/Espo/Custom/Core/Utils/Database/Orm/Fields/PersonName.php > PersonName.txt
                2. espocrm/custom/Espo/Custom/Resources/metadata/fields/personName.json > PersonName(entityDef_field).txt
                3. espocrm/client/custom/src/views/fields/person-name.js > personName(jsScript).txt
                4. espocrm/custom/Espo/Custom/Resources/i18n/en_US/Settings.json
                5. espocrm/custom/Espo/Custom/Resources/metadata/entityDefs/Settings.json > Settings(entityDef).txt
                6. espocrm/client/custom/res/templates/fields/person-name/edit-first-middle-last-suffix.tpl > personName(tpl).txt

                I have attached all the files.

                Expected Result :

                First Name: John
                Middle Name : K
                Last Name: Smith
                Suffix Name : Jr

                Name : John K Smith Jr
                Attached Files


              • #10
                Sorry for digging up a graveyard post, but it took me a moment to find where this got moved to. The settings to enable Middle names are now part of the overall "Name Format" setting, which is under:

                Administration -> Settings -> Locale (Tab) -> Person Name Format (Dropdown)

                Prefixes are supported, but Suffixes will need to be included in the last name or a separate field will need to be created, per the examples above - although note that some of the file names have changed, and I'd be surprised if Ananya's updates survived from 2021 to now, given those changes.