Convert Base Entity to Person

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nsns
    Junior Member
    • Jun 2019
    • 20

    Convert Base Entity to Person

    I have create a new entity and i choose base as type. Can i convert it to person now?
    Thanks.
  • Maximus
    Senior Member
    • Nov 2018
    • 2731

    #2
    Hello.
    You can't convert it via UI. You should recreate it.

    Comment

    • nsns
      Junior Member
      • Jun 2019
      • 20

      #3
      So i will loose all my data and all the associations for this specific entity?
      Thanks.

      Comment

      • Maximus
        Senior Member
        • Nov 2018
        • 2731

        #4
        You can also try to change it on the code level, but I didn't test that. It may be not safe.

        Comment

        • nsns
          Junior Member
          • Jun 2019
          • 20

          #5
          I only want to have the e-mail and phone fields like they are in contacts.
          How can i do that in code level?
          Thanks.

          Comment

          • Maximus
            Senior Member
            • Nov 2018
            • 2731

            #6
            If you just need to have such fields in your Entity you can do the next:
            1. Open the EspoCRM/custom/Espo/Custom/Resources/metadata/entityDefs/YUOR_ENTITY.json file;
            2. Add into the field's block the next code:
            Code:
            "emailAddress": {
                "type": "email",
                "isPersonalData": true
            },
            "phoneNumber": {
                 "type": "phone",
                 "typeList": [
                     "Mobile",
                     "Office",
                     "Home",
                     "Fax",
                     "Other"
                 ],
                "defaultType": "Mobile",
                "isPersonalData": true
            },
            3. Go to Administration -> Rebuild and press F5 to reload your webpage.
            4. Go to the Layout Manager and add these fields into the layout.

            Comment

            • abisbe
              Member
              • May 2021
              • 60

              #7
              Hi, I'm trying to solve this same issue,

              For that, I would like to understand your solution, will adding those fields on the entittyDef JSON make the history of the record show the emails ?

              What I'm trying to do is help our user by having the emails related on the history panel of that entity that I want to convert to Person. And I've tried your solution, and I can't see anything on history mail related.

              Thanks a lot.

              Comment

              • shalmaxb
                Senior Member
                • Mar 2015
                • 1602

                #8
                Though I don`t know, how you did it so far, be aware, that in parent relationships there it is necessary to add the entity list (apperas after you established the correct relationship). Maybe this is not there yet or you did not see yet.
                It appears in the relationship.
                And you will have to add the field with the desired values to your layout.

                Comment

                • abisbe
                  Member
                  • May 2021
                  • 60

                  #9
                  Hi,

                  So I followed what you said, shalmaxb , and I found that the parent relationships were put in place automatically, great, but still the history was not showing related emails from that field on that record.

                  After scrapping for a bit longer of what were the differences between files when a Person type entity and BasePlus one, I found that on the JSON file located at /metadata/scopes/ there were 2 differences, the type of entity this one very clear, and the Person type one had an extra line saying "hasPersonalData":true

                  After adding this extra line on the JSON I could finally see the emails on the system related to the email address informed on the new added field.

                  Please correct me if I you think some of this should not be tampered with.

                  And thanks again for your help.

                  Comment

                  • shalmaxb
                    Senior Member
                    • Mar 2015
                    • 1602

                    #10
                    Hi, I have never used that, but as you came to the solution sounds good. This is something, you can learn with espoCRM: It let`s you compare and try, mostly with success.
                    Besides that, for me it is always fun to make these "experiments" and getting surprising (positively) results.

                    Comment

                    • abisbe
                      Member
                      • May 2021
                      • 60

                      #11
                      It is!

                      I'm really enjoying playing with it. Thanks to all the community and dev!

                      Comment

                      Working...