In Microsoft Dataverse, many records have an Owner field that controls access and often receives notifications when something about the record changes.
When you first build a Power Automate flow to send an email to a record owner, you quickly realize a complication:
The Owner field can reference either an individual User or a Team.
If you don't account for this difference, your flow could break—or worse, send no notifications at all.
Here’s a method for dynamically identifying the owner type and getting the correct email addresses, whether it’s a single user or an entire team.
Step 1 — Create a String Variable
Start by initializing a string variable to hold the email address(es).
I typically name it something like varEmailAddress for clarity.
Step 2 — Check the Owner Type
When you retrieve your record (using Get a row by ID or List rows), examine the Owner (Type) field.
This field tells you if the owner is a User (systemuser) or a Team (team).
Create a Condition step in your flow:
Check if Owner (Type) equals
"team".This will allow you to branch your logic based on whether you're dealing with a team or an individual.
Step 3 — If the Owner is an Individual (User)
This is the simpler case.
Use a Get a row by ID step with the following inputs:
Table Name: Users
Row ID:
Owner (Value)Select Columns:
internalemailaddress
Then, Set Variable to update varEmailAddress with the user's primary email address (internalemailaddress).
Step 4 — If the Owner is a Team
This case requires a few more steps because you must retrieve all team members associated with the team.
Get a Row by ID for the Team:
Table Name: Teams
Row ID:
Owner (Value)Expand Query:
teammembership_association($select=internalemailaddress)
Tip:
The teammembership_association is the many-to-many relationship name between Teams and Users.
To find it, go to the Teams table, filter by Many-to-Many Relationships, and locate the relationship pointing to the Users table.
2. Apply to Each:
Use an Apply to Each control to loop over the expanded team member results.
Set the array input to:
outputs('Get_a_row_by_ID_Team')?['body/teammembership_association']
(Notice: You reference the relationship name directly after 'body/'.)
3. Inside the Loop:
Add a Compose action to view the current item.
Then use Append to String Variable to append each user's email address:
outputs('Compose')?['internalemailaddress']
Why This Matters
This approach:
Works whether the owner is a User or a Team without hardcoding anything.
Makes your flows much more flexible and reliable.
Provides a method you can reuse anytime you work with many-to-many relationships in Dataverse.
Final Thoughts
Handling Dataverse ownership logic may feel tricky at first—but a few simple checks and the right expansion queries will make your Power Automate flows more resilient and dynamic.
This method has saved me hours of debugging, and I hope it helps you too!