How is this field made
Collapse
X
-
Hi shalmaxb ,
This is how Espo does it:
The field "role" is actually a field in the "middle table" account_contact which is used to link the entities Account and Contact in a many-to-many relationship
This field ("role") and the other additional field "isInactive" are defined in the Contact.json entityDefs metadata file as "columns" of the field and link "accounts":
Code:{ "fields": { ... "accounts": { "type": "linkMultiple", "view": "crm:views/contact/fields/accounts", "columns": { "role": "contactRole", "isInactive": "contactIsInactive" }, "orderBy": "name" }, ... }, "links": { "accounts": { "type": "hasMany", "entity": "Account", "foreign": "contacts", "additionalColumns": { "role": { "type": "varchar", "len": 100 }, "isInactive": { "type": "bool", "default": false } }, "additionalAttributeList": ["columns"], "layoutRelationshipsDisabled": true, "columnAttributeMap": { "role": "accountRole", "isInactive": "accountIsInactive" } }, .... } }
Code:{ "links" { .... "contacts": { "type": "hasMany", "entity": "Contact", "foreign": "accounts", "columnAttributeMap": { "role": "contactRole", "isInactive": "contactIsInactive" } }, .... } }
Hope this helps -
It been ask a couple of time, myself included but at the end it was still too hard for me. I listed it under section 3.5 of the 'wiki'. But looking at telecastg and the previous post I think this would be the easiest to follow if you want to do it.
3.5 Require Coding - Related to Entity & Field
Comment
-
At version 6.1+ something changed, because the configuration of "additionalColumns" from version 5.9.4 is not working right now, the columns that should appear in middle table are append in entity table, somebody knows how to manage this issue?Comment
-
If you find EspoCRM good, we would greatly appreciate if you could give the project a star on GitHub. We believe our work truly deserves more recognition. Thanks.Comment
Comment