Power Community

Power Community

Relationships in Dataverse managed with Power Automate

In Dataverse you can create relationships between tables, but how do you manage the relationships from a flow in Power Automate?

Relationships in Dataverse

In Dataverse there are a number of different type of relationships that you can create.

  • Many-to-one/Lookup
  • One-to-Many
  • Many-to-Many

Relationship examples

Consider the following tables:

  • Address
  • Car
  • Company
  • Person
Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image

Many-to-one relationships

If we created a relationship between the car table and the Person table called Main Driver. Then we would create a Many-to-one relationship (car being the primary table) or a Lookup. Lookup and Many-to-one relationships are the same thing.

Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image 1

Many-to-many relationships

If we created a relationship between car and the Person table called Drivers ( a car can have more than one drive but only one main driver), then we would select a Many-to-many relationship

One-to-Many relationships

One-to-many relationships are the same as Many-to-one relationships but with the primary and secondary tables reversed.

Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image 2

Relating records in Power Automate

To start this example I will create a flow that creates a record to my Car table and a Person record to my People table.

Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image 3

I can now use the relate rows action to link the car with the person through the Many-to-many relationship. That I use to register all the drivers of the car.

Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image 4

The Maindriver relationship however is not listed here.

Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image 5

If I however switch the update around and

Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image 6

Now I can select the Maindriver relationship without any issue.

Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image 7

So the Relate with record needs to be referring to the table at the Many end of the One-to-Many or Many-to-one relationship.

As we connected Person 1 with Car 1 in the above action our Main Driver for Car 1 will be Person 1.

Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image 8

Using the relate action we can update our Many-to-Many relationship just the same way as we updated the Many-to-one relationship.

Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image 10

When I feed the above flow with Person 2 and Car 2, I will end up with a main driver and drivers set to Person 2.

Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image 9

The pains of relate rows

Hey, there is now SharePains.com post without a bit of a pain point. So far all worked well, but …

Recently I came across a bit of an issue with the relate rows action. My action was configured correctly.

Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image 11

As my flow was running there were no failures and the action reported its green tick telling me that all had worked as expected. But …

The relationship wasn’t updated. I’ve seen this once before. Using the Update a row action and specifying the relationship in the classic way, did work.

Relationships in Dataverse managed with Power Automate Microsoft Dataverse, Microsoft Power Automate image 12

This post was originally published on this site

- Advertisement -spot_img

LEAVE A REPLY

Please enter your comment!
Please enter your name here

- Advertisement - Advertisement

Latest News

5 Benefits of In-App Notifications for Microsoft Dynamics 365 CRM users

For a successful sales process, you need to stay up-to-date with crucial sales information like deal closures, opportunities won,...

More Articles Like This

- Advertisement -spot_img