Skip to main content

Notifications

Microsoft Dynamics 365 | Integration, Dataverse...
Suggested answer

Many-to-many relationship

Posted on by 15

Hello,

Scenario: I'm building a vendor management model driven application. I have used the Contact entity to for Freelancers and created a custom entity named Certifications.

The certifications entity contains all the MS certifications  available. One freelancer can have multiple certifications associated with him or her and hence I have created a many-to-many relationship between Contacts and Certifications as show in the Fig-1.

Fig_2D00_1.png

Issue: After creating the relationship I have added the Certification subgrid in the Freelancers(Contact) form which shows me all the certifications associated with that a specific freelancer as show in Fig-2.

Fig_2D00_2.png

I'm unable to do that same in the Certifications form. I don't see the all the freelancers associated with a specific certification (Fig-3)

Fig_2D00_3.png

Please help.

  • Suggested answer
    Nya Profile Picture
    Nya 29,056 on at
    RE: Many-to-many relationship

    Hi,

    As what are shown in your screenshot, the settings of the sub-grids should meet your requirements.

    All you need to do is to tick the Show related records option so that only related records can be displayed.

     pastedimage1618558860736v1.png

    If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.

    Best Regards,

    Nya

  • mithun_m Profile Picture
    mithun_m 15 on at
    RE: Many-to-many relationship

    Hi,

    The forms I have are:

    • Contact (Freelancer )
    • Certification 

    I have created only one relationship. 

    Contact Form:

    pastedimage1618400530872v1.png

    Certifications Form:

    pastedimage1618400668010v2.png

    I'm unable to figure out the solution. 

    This is my requirement: 

    • If I click on a specific certification then I should be able to see all the Freelancers (Contacts) associated with that certification
    • If I click on a specific Freelancer (Contact), that I should be able to see all the certifications associated with that Freelancer(Contact)

    I have renamed that Contact entity as Freelancers and created a new entity called Certifications. I have established a many-to-many relationship between the two entities.  

    Can you please guide further?

  • Suggested answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Many-to-many relationship

    Hi,

    I can see you have created another relationship with Contact (as lookup) named Freelancer. This will be empty if you do not fill it. There is no need of it as you have created a many-to-many relationship.

    There are 2 forms and you need to set it as following:

    • Contact: on the subgrid and select Certifications table here (many to many relationship).
    • Contact (freelancer): on the subgrid select Certifications table here (many to many). If you have multiple relationships, you need to select the correct one.

    Also, you cannot show Freelancer in the subgrid on the Contact, because it is already showing data related to current account. Remove this column form the view.

    Similarly, when you open certification, you should only see list of freelancer (not certification names).

  • Suggested answer
    Nya Profile Picture
    Nya 29,056 on at
    RE: Many-to-many relationship

    Hi,

    This is the same reason why you can't show the category of the certificate in the contact view.

    Each row of the Sub-Grid in your screenshot represents one record of a certificate, which can correspond to multiple Contacts and cannot uniquely identify a Freelancer.

     

    If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.

    Best Regards,

    Nya

  • Suggested answer
    Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Many-to-many relationship

    Hi,

    On the certifications form sub-grid, you should select Contact as related table.

  • mithun_m Profile Picture
    mithun_m 15 on at
    RE: Many-to-many relationship

    Hi,

    I did that changes you mentioned, however I'm now facing a new issue.

    pastedimage1618391931589v1.png

    Kindly help!

  • mithun_m Profile Picture
    mithun_m 15 on at
    RE: Many-to-many relationship

    Hi,

    Thank you for replying.

    The sub-grid configuration is as shown below: 

    pastedimage1618391028593v1.png

  • Suggested answer
    Nya Profile Picture
    Nya 29,056 on at
    RE: Many-to-many relationship

    Hi,

    It’s something wrong with the view you selected for the sub-grid.

    You need to choose a view for Contacts. It can be set with a coming with the system one or customized one.

    pastedimage1618390974959v1.png

    What’s more, the Category in Fig-3 cannot be set in the view of Contacts for the N: N relationship between the two entities. (A contact can have more than one certificate, which means there can be more than one category. A row in this View corresponds to one contact record and cannot display multiple categories.)

     

    After saving and publishing the form, you’ll get the sub-grid of contacts in the form of certification.

     pastedimage1618391000626v3.png

    If this helped you, I'd appreciate it if you'd mark this as a Verified Answer, which may in turn help others as well.

    Best Regards,

    Nya

  • Wahaj Rashid Profile Picture
    Wahaj Rashid 11,319 on at
    RE: Many-to-many relationship

    Hi,

    Thank you for your query.

    Can you share your sub-grid configuration on the Certifications form?

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

December Spotlight Star - Muhammad Affan

Congratulations to a top community star!

Top 10 leaders for November!

Congratulations to our November super stars!

Community AMA December 12th

Join us as we continue to demystify the Dynamics 365 Contact Center

Leaderboard

#1
André Arnaud de Calavon Profile Picture

André Arnaud de Cal... 291,240 Super User 2024 Season 2

#2
Martin Dráb Profile Picture

Martin Dráb 230,149 Most Valuable Professional

#3
nmaenpaa Profile Picture

nmaenpaa 101,156

Leaderboard

Product updates

Dynamics 365 release plans