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...

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

Helpful resources

Announcements
Power Apps Africa Challenge 2022

Power Apps Africa Challenge

Your chance to join an engaging competition of Power Platform enthusiasts.

Super User 2 - 2022 Congratulations

Welcome Super Users

The Super User program for 2022 - Season 2 has kicked off!

September Events 2022

Check out all of these events

Attend in person or online, there are incredible conferences and events happening all throughout the month of September.

Government Carousel

New forum: GCC, GCCH, DoD - Federal App Makers (FAM)

In response to the unique and evolving requirements of the United States public sector, Microsoft has created Power Apps US Government.

Users online (5,505)