In this Pragmatic Works training video, Nate Halliwell demonstrates how to work with many-to-many (M2M) relationships inside Power Automate. Building on his earlier tutorials about using M2M relationships in Canvas Apps, Nate shifts the focus to Power Automate and shows how to retrieve related records efficiently when changes occur in Dataverse tables.
Nate begins with a simple scenario: when the start date for a class changes, the system should automatically find all students enrolled in that class and send them an email notification. He uses a Dataverse solution that contains both students and classes, linked together with a many-to-many relationship.
To automate this, Nate creates an Automated Cloud Flow in Power Automate:
The challenge comes immediately: Power Automate’s Dataverse connector allows relating or unrelating rows but doesn’t directly return all related records. Nate explains that although there are more complex approaches like fetchXML queries, he wants to demonstrate the easiest method.
Behind the scenes, Dataverse generates a hidden relationship table when a many-to-many relationship is created. While users cannot edit or add columns to this table, it can still be queried. Nate shows how to locate the relationship table name:
M2M_student_M2M_class.In Power Automate, a List Rows action is added. Since the table is not searchable in the UI, Nate enters the relationship table’s logical name manually. The key trick is appending Set to the name, resulting in something like M2M_student_M2M_classSet.
Once the rows are listed, Nate filters them to only return records related to the class that was changed:
M2M_classId eq [Class GUID].Testing this filter confirms that only the relevant student records are returned. For example, if three students are enrolled in Math, the query returns exactly three rows.
At this point, the flow has the GUIDs for each related Student. Nate adds another step:
With student details in hand, Nate configures an Email action:
Testing the flow confirms that each related student receives a personalized email when the class date changes.
Set appended.Nate Halliwell demonstrates how to bridge many-to-many relationships across the Power Platform by leveraging the hidden relationship table in Dataverse. His approach makes it easy to retrieve related records and automate workflows such as notifying students of class changes. This tutorial rounds out the understanding of M2M relationships, extending their use beyond Canvas Apps into Power Automate for practical automation scenarios.
Don't forget to check out the Pragmatic Works' on-demand learning platform for more insightful content and training sessions onPower Automate and other Microsoft applications. Be sure to subscribe to the Pragmatic Works YouTube channel to stay up-to-date on the latest tips and tricks.