Announcement

Collapse
No announcement yet.

Name field in Contact entity

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • 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.

  • #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


    • #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


      • #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


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

          Comment


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

            Comment


            • #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


              • telecastg
                telecastg commented
                Editing a comment
                Thanks for the compliment Maximus
                Last edited by telecastg; 03-11-2021, 03:44 AM.

            • #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


              • #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


                • #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


                  • #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


                    • #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...
                      X