Name field in Contact entity

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • bakvik
    Junior Member
    • Mar 2021
    • 22

    Name field in Contact entity

    Hi, the Name field in the Contact entity seems to be calculated from other fields. In the detail view, when you open the Name field for editing, it consists of saluation + firstName + lastName. In the list view however, the Name field consists of firstName + lastName. Is it possible to change the definition of the Name field somehow in the Administration interface? I couldn't find anywhere this dynamic behaviour is defined in the Entity Manager or Layout Manager.
    Thanks.
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hi,
    The 'name' field logic can be changed by code customization.
    Anyway, the main question is what goal do you want to achieve. Perhaps it doesn't need coding.

    Comment

    • bakvik
      Junior Member
      • Mar 2021
      • 22

      #3
      Hi, thanks. In the list view for contact, I would like the Name column to include the Salution (people in my country are big on salutations, academic titles, etc) and expect them to be displayed before the name in all views.

      Comment

      • Maximus
        Senior Member
        • Nov 2018
        • 2731

        #4
        I see.
        Well, w/o changing you can only add the salutation column to the List view in Administration -> Layout Manager -> Contacts -> List -> Salutation.

        Comment

        • bakvik
          Junior Member
          • Mar 2021
          • 22

          #5
          Yeah, I know about that. It just doesn't look good. Thanks anyway.

          Comment

          • bakvik
            Junior Member
            • Mar 2021
            • 22

            #6
            Where in the code is the Name field calculated in the Contact List layout? If I just want to "hack it".

            Comment

            • Maximus
              Senior Member
              • Nov 2018
              • 2731

              #7
              Unfortunately, it is out of my knowledge. I will move your topic to the Developer Help branch. Probably someone has already done it.
              Also, you may involve telecastg to this task. He is very good in front-end customization

              Comment

            • bakvik
              Junior Member
              • Mar 2021
              • 22

              #8
              Thanks Max . I don't even know whether to start looking in the backend (if the field is calculated in the BE and presented to the FE the same as a normal field), or in the frontend (if the field is purely a FE artifact constructed on the fly in JS). And neither my PHP or JS is good enough to enable me to answer there questions for myself.

              Comment

              • telecastg
                Active Community Member
                • Jun 2018
                • 907

                #9
                Hi, the script that generates the "personName" field is this: https://github.com/espocrm/espocrm/b...person-name.js

                To get a better idea of which scripts control what areas, you can check these posts:

                https://forum.espocrm.com/forum/developer-help/67253-reference-for-coders-gui-which-scripts-control-an-entity-s-detail-view

                https://forum.espocrm.com/forum/developer-help/61108-reference-espo-gui-script-map-guide-where-can-i-change-something


                Also, since you are new to Espo, if you are not familiar with the Backbone.js framework, on which Espo is based, I strongly recommend that you read about it.

                You don't need to become a Backbone expert because Espo is a highly evolved framework on its own, but it will help a lot understanding how the program flow works.
                Last edited by telecastg; 03-10-2021, 04:58 PM.

                Comment

                • bakvik
                  Junior Member
                  • Mar 2021
                  • 22

                  #10
                  Thanks for the pointers. Yes, I've dug around the Espo client code enough to realise it is its own framework using bits and piece from other libraries (including the router from Backbone that you mentioned). OK, I'll have a rummage though the code to see if I can solve it.

                  After making any changes to the client, I assume rebuilding espo.js is necessary and that's is just npm install and grunt, right? (having all the dependencies installed of course).

                  This has been very helpful. Thanks!

                  Comment

                  • telecastg
                    Active Community Member
                    • Jun 2018
                    • 907

                    #11
                    You're welcome,

                    Espo is very easy to customize, you don't have to rebuild anything manually after making code changes, just go to Administration >> Rebuild and Espo will automatically rebuild the front end, back end and if necessary will alter the database, it's really easy.

                    Alternatively, you can use CLI and type php rebuild.php

                    After using Espo for a couple of years now, I consider it more of an "application generator" than a framework. You can make a lot of customizations using the Administration GUI and then refine manually anything that you want.

                    Comment

                    • shalmaxb
                      Senior Member
                      • Mar 2015
                      • 1611

                      #12
                      Hello,
                      you can achieve this without coding very easily with a formula:

                      first create a new field for the output of salutation together with name (here I call it salutationName), then make this formula:

                      Code:
                      salutationName=string\concatenate(salutationName, ' ', name);
                      Then in Layout you hide the normal name field, put the new field in place and make it a link (so you can go from the list view to the detail view. That`s it

                      Comment

                      Working...