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

Welcome to the User Group Public Preview

Check out new user group experience and if you are a leader please create your group

MBAS Attendee Badge

Claim Your Badge & Digital Swag!

Check out how to claim yours today!

secondImage

Demo Extravaganza is Back!

We are excited to announce that Demo Extravaganza for 2021 has started!

MBAS on Demand

Microsoft Business Applications Summit sessions

On-demand access to all the great content presented by the product teams and community members! #MSBizAppsSummit #CommunityRocks

Power Apps June 2021

June Power Apps Community Call

Don't miss the call this month on June 16th - 8a PDT

Top Kudoed Authors
Users online (81,221)