cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
alirich
New Member

Many-to-Many Relationship Specific Fields

Hi, 

 

I've got quite a few many-to-many relationships in my CDS, I need relationship specific data but it doesn't seem to be possible in CDS, is this true? Are there any workarounds for this?

My example is that I have 2 entities: Clients and Directors. Each Client can have multiple directors and each Director can have multiple clients. This is possible with the many-to-many relationship. However, I also need to know what date Director A was appointed to the board of Client 1 and whether Director A is the chairman for Client 1. This is data very specific to the relationship between a Client and Director, is this possible to do with CDS? Or are there any workaround options for this?

 

Normally I would do Company(1) -> (many)CompanyDirector(many) <- (1)Director, and CompanyDirector has the fields: CompanyID, DirectorID, DateOfAppointment and Chairman(boolean).

Thanks


1 ACCEPTED SOLUTION

Accepted Solutions
EricRegnier
Super User
Super User

Hi @alirich,

Unfortunately with out-of-the-box many-to-many (N-N) relationship we cannot add additional fields to the relationship entity which is one of the main reasons I'm not a big fan of those. The workaround is to create a custom N-N relationship by using a custom entity as the junction. In your example, have an entity called something like "Client Director" with two lookups fields; one on Client and the other on Director.  You can then add any additional fields on that entity.

Hope this helps...

View solution in original post

2 REPLIES 2
EricRegnier
Super User
Super User

Hi @alirich,

Unfortunately with out-of-the-box many-to-many (N-N) relationship we cannot add additional fields to the relationship entity which is one of the main reasons I'm not a big fan of those. The workaround is to create a custom N-N relationship by using a custom entity as the junction. In your example, have an entity called something like "Client Director" with two lookups fields; one on Client and the other on Director.  You can then add any additional fields on that entity.

Hope this helps...

View solution in original post

In addition to Eric's suggestion, you could also use the Connection entity to link Clients and Directors

Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Users online (2,928)