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 II
Super User II

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 II
Super User II

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
PA_User Group Leader_768x460.jpg

Manage your user group events

Check out the News & Announcements to learn more.

Power Query PA Forum 768x460.png

Check it out!

Did you know that you can visit the Power Query Forum in Power BI and now Power Apps

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

R2 (Green) 768 x 460px.png

Microsoft Dynamics 365 & Power Platform User Professionals

DynamicsCon is a FREE, 4 half-day virtual learning experience for 11,000+ Microsoft Business Application users and professionals.

Users online (1,198)