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 Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

Users online (1,636)