Hello. I have a table, let's call it People, and another table Languages. I'd like for each person to have a language and a fluency level (1 to 5). The catch is that I'd like to have it show similar to a 'Link multiple field'. Currently this is possible, but without the extra field 'Fluency level'. Is there a way to add this field to the link multiple field view? For example, for fluency level 4 english, see pic. Thanks!
Announcement
Collapse
No announcement yet.
Adding a field to Many-to-many middle table
Collapse
X
-
I am trying to achieve the same thing.
After looking at the relationships between Account and Contact, I created fields like accountRole but I could not get the field to show up after assigning an entity to the contact.
Not sure how to completely copy the contacts - accounts scheme to a new entity with subfields like "accountRole".
What I want to achieve is the following:
Entity "Contact" has a connection to a "Product" but for every product that is assigned to the "Contact" a price, amount etc. must be set that is attached to this unique relationship (middle table).
So for the same product different contacts can have different prices, amounts etc.
I only tried the entity manager and layout manager but no code adjustments.
Is this even possible without code adjustments?
Thanks in advance!Last edited by phil; 05-04-2018, 09:01 AM.
Comment
-
Originally posted by tanya View PostI show you the similar usage in EspoCRM but with Accounts and Contacts.
but here you can set the role (title) of contact on Contact view in Accounts field, but in Account you can see the panel of related contacts with roles.
Here you can set the role on Property view, but need this field on Contact view in Properties relationship table. That's why I ask you to check, how does implemented in Account and Contact enittyDefs.
EspoCRM – Open Source CRM Application. Contribute to espocrm/espocrm development by creating an account on GitHub.
EspoCRM – Open Source CRM Application. Contribute to espocrm/espocrm development by creating an account on GitHub.
In property layouts create listForContact.json, in clientDefs relate this entity to the panel
EspoCRM – Open Source CRM Application. Contribute to espocrm/espocrm development by creating an account on GitHub.
https://github.com/espocrm/espocrm/b...count.json#L50
open application/Espo/Modules/Crm/Resources/metadata/entityDefs/Contacts.json and Opportunity.json (I think it's easier to understand)
You can create your relationship with EntityManager (what you did), after you can improve this relationship
Opportunity > links > contacts has "additionalColumns" option - here you need to define your additional fields for data base
in Contact fields defined opportunityRole field,
in Opportunity > contactRole and contacts with columns. Also you need to create a view for your linkMultiple field
- Likes 1
Comment
-
Hey Tanya,
What about creating these views e.g contacts field view in opportunity with role, if we create the custom fields in similar place will these field show in : EnitiyManager -> fields and also in LayoutManager ?
I hope there is a more simpler step by step reply explaining how to create fields in both related entities and their view
-
Thank you Tanya for answer. It really helps (but also require some code researching )
How I can get additional fields in API request?
For example, if I do searching by GET /..../MyEntity?select=myFieldIds - I got linked items with names and ids but without additional fields. I already try many combinations like myFieldColumns, myFieldFieldNames and many other - it did't help.
If I request full record like GET /..../MyEntity/SOME_ID - I got all needs, but doing requests for every searching result is too slow and stupid
-
you may also declare the middle table as a standard entity, something like ContactsAccounts, then you can link it with both contact and account
then you can define fields as you want, the only limit is that you cannot set the related records on the fly while you are creating the main entity.
if this limitation is painful, you can use an extension I made that help for inserting the related entities on the fly like in this video
Comment
Comment