web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Many-to-many relations...
Power Apps
Unanswered

Many-to-many relationships are NOT reciprocal?

(0) ShareShare
ReportReport
Posted on by 4

Hi - I'm creating a many-to-many relationship in a custom model driven PowerApp, specifically Account <-> Account.

I have added subgrid in form on the Account entity, but when I make a relationship from Account A to another Account B via the subgrid view button 'Add Existing Account' it only shows up in the subgrid view on the Account A, where I created the relationship originally. When I then navigate to the other Account B, it does not show up.

I can then do the same in reverse from Account B to make it show up, but it feels like I'm creating 2 separate one-way relationships.

The documentation mentions many-to-many relationships are 'reciprocal' - I assumed that this behaviour is not reciprocal as I need it to be?

https://docs.microsoft.com/en-gb/powerapps/maker/common-data-service/create-edit-nn-relationships


Am I missing something?

Categories:
  • Ralph Soto Profile Picture
    4 on at

    I am encountering the same issue. How is it reciprocal if it does not show up on both grids on the form?

  • Ralph Soto Profile Picture
    4 on at

    So in order to get the relationship to appear on both sides, I created a plugin on the associate and dissassociate event. From there I referenced the target and related entity records. I am checking the relationship name returned with ".Referencing" then making the reciprocal relationship using ".Referenced" and flipping the entity in the association and disassociation.

    Here is the code

    private static void ReciprocalRelationship(IOrganizationService service, IPluginExecutionContext context,
    EntityReference targetEntity, EntityReference relatedEntity, string relationshipName, string tableName)
    {
    if (targetEntity.LogicalName == contact.LogicalName &&
    relationshipName == tableName + ".Referencing")
    {
    var relationship = new Relationship()
    {
    PrimaryEntityRole = EntityRole.Referenced,
    SchemaName = tableName
    };

    if (context.MessageName == MessageNames.Associate)
    service.Associate(targetEntity.LogicalName, targetEntity.Id, relationship,
    new EntityReferenceCollection { relatedEntity });

    else if (context.MessageName == MessageNames.Disassociate)
    service.Disassociate(targetEntity.LogicalName, targetEntity.Id, relationship,
    new EntityReferenceCollection { relatedEntity });
    }
    }

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 383 Super User 2026 Season 2

#2
Mohsin Ali Profile Picture

Mohsin Ali 356

#3
WarrenBelz Profile Picture

WarrenBelz 232 Most Valuable Professional

Last 30 days Overall leaderboard