Announcement
Collapse
No announcement yet.
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
- Likes 1
Comment
Comment