Create Many-to-many table relationships in Microsoft Dataverse using Power Apps portal
The Power Apps portal provides an easy way to create and edit Many-to-many table relationships for Dataverse.
The portal enables configuring the most common options, but certain options can only be set using solution explorer. More information:
- Create N:N (many-to-many) table relationships
- Create N:N (many-to-many) table relationships in Dataverse using solution explorer
View Many-to-many table relationships
- From the Power Apps portal, select either Model-driven or Canvas design mode.
- Select Data > Tables and select the table that has the relationships you want to view.
- With the Relationships area selected, you can select the following views:
|All||Shows all the relationships for the table|
|Custom||Shows only custom relationships for the table|
|Default||Shows only the standard relationships for the table|
Many-to-many relationships will have a Relationship type of Many-to-many.
The table you view may have no Many-to-many relationships.
While viewing table relationships, in the command bar, select Add relationship and choose Many-to-many.
In the Many-to-many panel, choose the table you want related to the current table.
Select More Options to view the Relationship Name and Relationship table name columns.
The values for these columns are generated for you based on the tables chosen.
If you create more than one Many-to-many relationship with the same two tables, you will need to edit the generated Relationship Name and Relationship table name columns so that they will be unique.
Select OK to close the Many-to-many panel. The relationship will be created when you save changes to the table.
Create a many-to-many relationship with the same table (self-referential relationship)
There may be times when you need to create a many-to-many relationship that references the same table. For example, account records may have multiple parent account records. However, if the self-referential relationship doesn’t have custom labels configured, distinguishing the two related record types that appear in the app won’t be apparent to users. This is because the related records appear twice in the app by using the same table name. To create a self-referential relationship, use custom labels.
Create a new custom table. In this example, the table is named Custom table.
Open the classic solution explorer, open the custom table, and in the N:N Relationships section create a new Many-to-Many Relationship.
Complete the relationship definition as follows. Make sure to add custom labels to both the current and the other table’s relationship:
Current table section
- Display option: Use Custom Label
- Custom Label: Primary Custom Table Relationship
Other table section
- Entity Name: Custom table
- Display Option: Use Custom Label
- Custom Label: Secondary Custom Table Relationship
Save the relationship, and then publish the customization.
Because the related record types use the custom labels defined for the self-referential relationship instead of the table name, users running the app can distinguish between the two related record types that exist.
While viewing table relationships, select the relationship you want to delete.
You can use the Delete relationship command from the command bar or from the row context menu when you select the ellipses (...).
Deleting the Many-to-Many relationship will delete the relationship table created. All data connecting tables using the relationship will be lost.