Skip to main content

Notifications

Microsoft Dynamics CRM (Archived)

N:N relationship to itself - unable to show both subgrids/relationships on form

Posted on by Microsoft Employee

Hiya

We use the account entity to hold information on all of our customers. Some of our customers are Partners/Suppliers.

I am trying to set it to that on the organisation form you wuld be able to see a list of all the partners that supply the record you are looking at as well as if the record you are looking at supplies anyone.

This seemed to be a N:N to the same entity - add both display options and then rename them as "Partner From" and "Partner To". 

When I add the new relationship to the organisation (account) entity then the "other entity" display option is on my form but I cant get to the "current entity" display option. 

So all I can end up putting on the form is a "Partner from" subgird. If I use the arrows at the top of the record (related arrows?) I can see both my "partner from" and "partner to" area. 

Spent about 2 hours looking at this so far so any help would be greatly appreciated and I have UAT to test in

*This post is locked for comments

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: N:N relationship to itself - unable to show both subgrids/relationships on form

    Hi Chris

    Yup thats what i can see. Quite a few results for querying n:n relationships and i use a set org provides org in the join entity name so i can propose to buisness leaders the coding customisation for this outlying case.

    For anyone reading if required its just a work flow on delete of the join entity to run a check if there are other relationships for this org in the join entity and if not un set the flag. As this requires code and is an outlier i think we will be ok with manual intervension.

    Thank you for your help Chris. I read the custom n:n a bunch of times but could not visualise it. Once i made it incould see how it will bet better for reporting and advanced find. Ill mark your answer as the correct one :)

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: N:N relationship to itself - unable to show both subgrids/relationships on form

    That might be a bit trickier since the Account could have N partners, correct?  In theory you could put another workflow to execute on status change and/or delete of the relationship record, but it won't know if there are other related partners and could set the flag incorrectly.

    You could do this with a custom workflow item if you have the coding skills available.

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: N:N relationship to itself - unable to show both subgrids/relationships on form

    Hi Chris.

    Yea that is what i went with and works well. We have done similar for others so i coppied one and that sets the flag field ok.

    Last issue is now what happens when the last relationship is removed. The flag is still set to yes. I do not think i can sort this out of the box unless you have a suggestion.

    Clarifying if buisness process requires this. It will be a rare situation that a customer goes from having partner customers to none but would lile to uncheck the field of possible

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: N:N relationship to itself - unable to show both subgrids/relationships on form

    You are correct that you cannot use a business rule for this.  However, you can do a workflow on create/update of the N:N relationship record that goes to the parent account (whichever one it is) and sets the flag then?  The default Y/N would be set to N, and then when the N:N relationship record is setup, it goes and updates it to Y on the related record.

    Sound good?

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: N:N relationship to itself - unable to show both subgrids/relationships on form

    Hi Chris

    Thank you I had looked at these and thought its what i needed but got my head down to many paths yesterday so thank you. 

    A quick question for you to follow up: So now on account we have a grid of partners - is there a method for if there are results in this view/if there are partners for this customer then tick the "joint customer" tick box.

    It looks like i can not do this with business rules as there is no field to monitor for when a relationship is made. Basically if relationships of a certain type exist this needs to be true else be false. 

  • Verified answer
    Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: N:N relationship to itself - unable to show both subgrids/relationships on form

    The out of the box N:N relationship doesn't allow this, you'll need to create a custom N:N entity.  Take a look at this blog article on how to set one up.

    http://informaquest.com/index.php/2017/04/06/join-entities-in-dynamics-365-and-why-they-are-awesome/ 

  • Community Member Profile Picture
    Community Member Microsoft Employee on at
    RE: N:N relationship to itself - unable to show both subgrids/relationships on form

    So I can provide a small reproducible update:

    1) Have an entity - create a N:N relationship with neither field displayed - publish - no relationships on entity form

    2) Go to relationship - set current entity display option to plural names - publish - plural name appears in relationship explorer on form

    3) Go to relationship - set other entity display option to custom name - publish - plural name disappears and custom name appears

    Is there a way to have both sides of an N:N relationship display on the same form or is it one or the other?

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

Featured topics

Product updates

Dynamics 365 release plans