custom/Espo/Custom/Resources/metadata/clientDefs/CAddress.json
Code:
{
...
"relationshipPanels": {
"clients": {
"layout": null,
"selectPrimaryFilterName": null
},
"contacts": {
"layout": null,
"selectPrimaryFilterName": null
},
"vendors": {
"layout": null,
"selectPrimaryFilterName": null
}
},
"additionalLayouts": {
"listForAccount": {
"type": "list",
"isCustom": true
},
"listForContact": {
"type": "list",
"isCustom": true
},
"listForVendor": {
"type": "list",
"isCustom": true
}
}
}
Add the fields and links to the other entities:
custom/Espo/Custom/Resources/metadata/entityDefs/Account.json
Code:
{
"fields": {
"addressLabel": {
"type": "enum",
"options": ["Billing", "Clinic", "Daycare", "Home", "Home2", "School", "Other"],
"notStorable": true,
"utility": true,
"orderDisabled": true,
"maxLength": 20,
"pattern": "$noBadCharacters",
"layoutMassUpdateDisabled": true,
"layoutListDisabled": true,
"layoutDetailDisabled": true,
"layoutSearchDisabled": true,
"fieldManagerParamList": [
"pattern"
]
}
},
"links": {
"cAddresses": {
"type": "hasMany",
"entity": "CAddress",
"foreign": "clients",
"columnAttributeMap": {
"label": "addressLabel"
},
"relationName": "cAddressClient"
}
}
}
Code:
{
"fields": {
"addressLabel": {
"type": "varchar",
"notStorable": true,
"utility": true,
"orderDisabled": true,
"maxLength": 20,
"pattern": "$noBadCharacters",
"layoutMassUpdateDisabled": true,
"layoutListDisabled": true,
"layoutDetailDisabled": true,
"layoutSearchDisabled": true,
"fieldManagerParamList": [
"pattern"
]
}
},
"links": {
"cAddresses": {
"type": "hasMany",
"entity": "CAddress",
"foreign": "contacts",
"columnAttributeMap": {
"label": "addressLabel"
},
"relationName": "cAddressContact"
}
}
}
Code:
{
"fields": {
"addressLabel": {
"type": "varchar",
"notStorable": true,
"utility": true,
"orderDisabled": true,
"maxLength": 20,
"pattern": "$noBadCharacters",
"layoutMassUpdateDisabled": true,
"layoutListDisabled": true,
"layoutDetailDisabled": true,
"layoutSearchDisabled": true,
"fieldManagerParamList": [
"pattern"
]
}
},
"links": {
"cAddresses": {
"type": "hasMany",
"entity": "CAddress",
"foreign": "vendors",
"columnAttributeMap": {
"label": "addressLabel"
},
"relationName": "cAddressVendor"
}
}
}

Leave a comment: