email_email_address : Can't add custom columns

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Firyo
    Senior Member
    • Jun 2022
    • 134

    email_email_address : Can't add custom columns

    Hi there,

    I need to add 3 new custom columns to the link table between "email" and "email_address" (email_email_address).
    The 3 columns are : 2 varchars fields and 1 datetime

    To add them I edited my already existant "custom/Espo/Custom/Resources/metadata/entityDefs/Email.json" file and added the following code (based on the default Espo entityDefs/Email.json).

    Code:
    "toEmailAddresses": {
        "type": "hasMany",
       "entity": "EmailAddress",
       "relationName": "emailEmailAddress",
       "conditions": {
          "addressType": "to"
       },
       "additionalColumns": {
          "addressType": {
             "type": "varchar",
             "len": "4"
          },
          "mailLastStatus": {
             "type": "varchar"
          },
          "mailLastDateTime": {
             "type": "datetime"
          },
          "messageId": {
             "type": "varchar"
          }
       }
    },
    "ccEmailAddresses": {
       "type": "hasMany",
       "entity": "EmailAddress",
       "relationName": "emailEmailAddress",
       "conditions": {
          "addressType": "cc"
       },
       "additionalColumns": {
          "addressType": {
             "type": "varchar",
             "len": "4"
          },
          "mailLastStatus": {
             "type": "varchar"
          },
          "mailLastDateTime": {
             "type": "datetime"
          },
          "messageId": {
             "type": "varchar"
          }
       },
       "layoutDefaultSidePanelDisabled": true
    },
    "bccEmailAddresses": {
       "type": "hasMany",
       "entity": "EmailAddress",
       "relationName": "emailEmailAddress",
       "conditions": {
          "addressType": "bcc"
       },
       "additionalColumns": {
          "addressType": {
             "type": "varchar",
             "len": "4"
          },
          "mailLastStatus": {
             "type": "varchar"
          },
          "mailLastDateTime": {
             "type": "datetime"
          },
          "messageId": {
             "type": "varchar"
          }
    },​
    ​
    Then, as usual I run
    Code:
    php ./rebuild.php
    , no error is triggered or logged

    BUT

    the table is unchanged, nothing happened.

    Regards,
    Firyo.
    Last edited by Firyo; 10-16-2024, 02:02 PM. Reason: Missing code added + code indented
  • Firyo
    Senior Member
    • Jun 2022
    • 134

    #2
    I found why I had this issue and fixed it.

    After using Xdebug to check how the rebuild is working I searched for other "links" that also had the "relationName" set to "emailEmailAddress".

    And there were one, named "replyToEmailAddresses" that was discarding my custom links new "additionalColumns".

    I added the link "replyToEmailAddresses" in my custom entityDefs file and added my 3 custom fields in it and IT WORKS !

    Comment

    Working...