User profile is not loading for users, but visible to admins due to a js error

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • crmtesting
    Member
    • Oct 2024
    • 49

    #1

    User profile is not loading for users, but visible to admins due to a js error

    User profile is not loading for users, but visible to admins. Reason: javascript error in console when user opens their profile, but there is no error when an admin does it.
    We are getting the following error in the console:

    Click image for larger version

Name:	image.png
Views:	0
Size:	22.5 KB
ID:	125367

    We are getting the error when:
    . it's a normal user and there is salutationName present and the layout has the "Name" field:
    Click image for larger version

Name:	image.png
Views:	0
Size:	13.6 KB
ID:	125364

    We are NOT getting any error when:
    1. An admin user sees any user profile
    2. if a regular user sees the profile but salutationName​ is null. Error is only when salutationName​ is there.
    3. if the "name" field is removed from the layout and replaced with separate fields for salutationName​, firstName and lastName.

    We are using self hosted espocrm for about 15-16 months now, and we noticed this last month. It was working fine earlier.

    this is the role assigned to the normal users:

    Click image for larger version

Name:	image.png
Views:	0
Size:	343.8 KB
ID:	125366
    Attached Files
  • heint
    Member
    • Jun 2025
    • 75

    #2
    Greetings, crmtesting,

    Could you please specify what Espo version you are using? Also, has any customization been made to the User entity earlier?
    You can also check the debug mode for more possible information.

    Comment

    • shalmaxb
      Senior Member
      • Mar 2015
      • 1860

      #3
      It may have to do with a mix of reasons.
      1. obviously it is caused by an option in a salutation part of a person field. There are options prepoulated, when you set such field
      2. The error says, an option is missing. This may occur in case of a relationship established between person fields in two entities, where the options are set differently, may happen, if your system is not en_US, but another language. So one entity looks for the related option but it perhaps had been set in another language, thus not accessible.
      3. same could be valid for different options in different language files.
      4. Can be caused by ACL (Roles). It does not happen for admin, because they do not fall under roles.
      5. same for when no option is selected, than it does not affect the other field.

      Is there anything in data/logs?
      check your relationships and all person fields you use in your app, if there is any inconsistence in the salutation part.

      Comment

      • yuri
        EspoCRM product developer
        • Mar 2014
        • 9740

        #4
        Check the custom language file. It's likely the option translations for the salutation are stored as null.

        Comment

        • crmtesting
          Member
          • Oct 2024
          • 49

          #5
          Originally posted by heint
          Greetings, crmtesting,

          Could you please specify what Espo version you are using? Also, has any customization been made to the User entity earlier?
          You can also check the debug mode for more possible information.
          Hello heint

          I am using version: 9.2.7, and I cannot upgrade to latest because I have installed this in docker and the php version is not supproted by the latest version.

          Regarding customizations of user entity, I have added a few fields, other than that I do not recall anything.
          I checked the debug mode, no error on the server. Seems it's a client side problem only.
          I have also "clear cache" and "rebuild" a few times.
          And I am using the default language.. english us probably.

          Comment

          • crmtesting
            Member
            • Oct 2024
            • 49

            #6
            Originally posted by shalmaxb
            It may have to do with a mix of reasons.
            1. obviously it is caused by an option in a salutation part of a person field. There are options prepoulated, when you set such field
            2. The error says, an option is missing. This may occur in case of a relationship established between person fields in two entities, where the options are set differently, may happen, if your system is not en_US, but another language. So one entity looks for the related option but it perhaps had been set in another language, thus not accessible.
            3. same could be valid for different options in different language files.
            4. Can be caused by ACL (Roles). It does not happen for admin, because they do not fall under roles.
            5. same for when no option is selected, than it does not affect the other field.

            Is there anything in data/logs?
            check your relationships and all person fields you use in your app, if there is any inconsistence in the salutation part.
            hey shalmaxb
            I am using the default espocrm language
            Click image for larger version  Name:	image.png Views:	0 Size:	19.1 KB ID:	125439

            I do not recall making any significant change in relationships.
            Also, I have shared the role of the user facing the problem. the user has proper access. Also, it is only happening when the "Name" field is there. If I replace it with Title, firstName, lastName, the error vanishes. In addition to this, when I inspect the json response received, we are getting the correct json response.

            As suggested, I changed the loglevel to DEBUG, but I did not get anything. this problem might be clientside.
            Last edited by crmtesting; Yesterday, 09:31 AM.

            Comment

            • crmtesting
              Member
              • Oct 2024
              • 49

              #7
              Originally posted by yuri
              Check the custom language file. It's likely the option translations for the salutation are stored as null.
              Hey yuri
              I am using the default language, and I also tried changing to English(UK), same situation.
              Click image for larger version  Name:	image.png Views:	0 Size:	19.1 KB ID:	125441
              Last edited by crmtesting; Yesterday, 09:27 AM.

              Comment

              • yuri
                EspoCRM product developer
                • Mar 2014
                • 9740

                #8
                Could you upload a zipped "custom/Espo/Custom/Resources/i18n" folder here? We'll try to investigate.

                Comment

                • crmtesting
                  Member
                  • Oct 2024
                  • 49

                  #9
                  Thank you yuri
                  here is the zipped file: https://drive.google.com/file/d/1NaH...ew?usp=sharing

                  Also, just for testing, I created a new role and gave access to everything. still getting the same error.

                  Comment

                  • lazovic
                    Super Moderator
                    • Jan 2022
                    • 1220

                    #10
                    Hi crmtesting,

                    Can you please show the Salutation field settings screenshot from Administration > Entity Manager > User > Fields > Salutation?

                    Comment

                    • crmtesting
                      Member
                      • Oct 2024
                      • 49

                      #11

                      Hello, lazovic , Here is the screenshot.
                      Click image for larger version

Name:	image.png
Views:	0
Size:	116.3 KB
ID:	125504

                      Comment

                      • victor
                        Active Community Member
                        • Aug 2022
                        • 1159

                        #12
                        Unable to reproduce your issue.

                        Alternatively, you can try the following:
                        1. In Administration > Entity Manager > User > Fields > Salutation, click "Reset to Default" and save the changes.
                        2. In Administration > Entity Manager > User > Layouts > Mass Update, add the Salutation field and save the changes.
                        3. In User entity List view via Mass Update, select an empty value for Salutation Name for all Regular Users and save the changes.
                        4. Make Rebuild.
                        5. Assign any Salutation Name to any Regular User.
                        6. Using the https://docs.espocrm.com/administrat...s-another-user feature, log in as this user in an incognito browser tab or in a browser that is not used to work with the current instance.
                        7. Check the browser console in the Regular User's profile.

                        Comment

                        • yuri
                          EspoCRM product developer
                          • Mar 2014
                          • 9740

                          #13
                          Maybe the Name field is forbidden for regular users in Roles in field level security?

                          Comment

                          Working...