Announcement

Collapse
No announcement yet.

Contact Name Field to Custom Entity

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

  • Contact Name Field to Custom Entity

    Hi,

    I want to create field Name in Contact for Custom entity.

    I tried with adding code from contact "application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contact.json" to my custom entity.

    Code:
             "name": {
                "type": "personName",
                "isPersonalData": true
            },
            "salutationName": {
                "type": "enum",
                "options": ["", "Mr.", "Ms.", "Mrs.", "Dr."]
            },
            "firstName": {
                "type": "varchar",
                "maxLength": 100,
                "default":"",
                "trim": true
            },
            "lastName": {
                "type": "varchar",
                "maxLength": 100,
                "required": true,
                "default":"",
                "trim": true
            },
    But It doesn't help me at all.

    Please advice.
    Cheers!
    Nishan.

  • #2
    Hi Nishan,
    If it is a new entity, then just create the Person type entity.
    For what entity are you trying to make it works?
    I didn't try this but I suspect that you need to make rebuild so the new fields will be created in your DB.

    Comment


    • #3
      Originally posted by Maximus View Post
      Hi Nishan,
      If it is a new entity, then just create the Person type entity.
      For what entity are you trying to make it works?
      I didn't try this but I suspect that you need to make rebuild so the new fields will be created in your DB.
      My entity type is base. For that I need that field.

      I tried rebuild that, But its getting a error Espo.ERROR: Fault to rebuild database schema. Details: There is no column with name 'name' on table 'f_a_c'.

      But I checked in the DB, name filed is available on the table.
      Cheers!
      Nishan.

      Comment


      • #4
        Helo Nishan,
        Please do this:
        1. Add to the file /custom/Espo/Custom/Resources/metadata/entityDefs/your-base-type-entity-name.json:
        1.1. into the field section:
        Code:
        "name": {
            "type": "personName"
        },
        "salutationName": {
            "type": "enum",
            "options": ["", "Mr.", "Ms.", "Mrs.", "Dr."]
        },
        "firstName": {
            "type": "varchar",
            "maxLength": 100,
            "default":"",
            "trim": true
        },
        "lastName": {
            "type": "varchar",
            "maxLength": 100,
            "required": true,
            "default":"",
            "trim": true
        },
        1.2.
        into the indexes section:
        Code:
        "name": {
            "columns": ["firstName", "lastName"]
        },
        Note. In my case I replace an old name field with this new one, so all previous records names have been delated and the name field become to show None.

        2. Administration -> Rebuid.

        Comment


        • #5
          Originally posted by Maximus View Post
          Helo Nishan,
          Please do this:
          1. Add to the file /custom/Espo/Custom/Resources/metadata/entityDefs/your-base-type-entity-name.json:
          1.1. into the field section:
          Code:
          "name": {
          "type": "personName"
          },
          "salutationName": {
          "type": "enum",
          "options": ["", "Mr.", "Ms.", "Mrs.", "Dr."]
          },
          "firstName": {
          "type": "varchar",
          "maxLength": 100,
          "default":"",
          "trim": true
          },
          "lastName": {
          "type": "varchar",
          "maxLength": 100,
          "required": true,
          "default":"",
          "trim": true
          },
          1.2.
          into the indexes section:
          Code:
          "name": {
          "columns": ["firstName", "lastName"]
          },
          Note. In my case I replace an old name field with this new one, so all previous records names have been delated and the name field become to show None.

          2. Administration -> Rebuid.

          I missed the 1.2 part which is in the indexes. Thank you for the support Max. Great!
          Cheers!
          Nishan.

          Comment


          • #6
            Originally posted by Maximus View Post
            Helo Nishan,
            Please do this:
            1. Add to the file /custom/Espo/Custom/Resources/metadata/entityDefs/your-base-type-entity-name.json:
            1.1. into the field section:
            Code:
            "name": {
            "type": "personName"
            },
            "salutationName": {
            "type": "enum",
            "options": ["", "Mr.", "Ms.", "Mrs.", "Dr."]
            },
            "firstName": {
            "type": "varchar",
            "maxLength": 100,
            "default":""[URL="https://mycoles.info/"],[/URL]
            "trim": true
            },
            "lastName": {
            "type": "varchar",
            "maxLength": 100,
            "required": true[URL="https://myestub.online/"],[/URL]
            "default":"",
            "trim": true
            },
            1.2.
            into the indexes section:
            Code:
            "name": {
            "columns": ["firstName", "lastName"]
            },
            Note. In my case I replace an old name field with this new one, so all previous records names have been delated and the name field become to show None.

            2. Administration -> Rebuid.
            Hey , i am thankful to you max for your effort, well i have been fixed my issue as well. But i want you to share more column execution code that i needed most.

            Thanks in advance

            Comment

            Working...
            X