Showing results for 
Search instead for 
Did you mean: 
Frequent Visitor

Query Dynamics 365 CE data with filter using n:n relationship

In Dynamics 365 CE there is a possibility in Advanced Find to query for records that have (or don't have) related records in a n:n relationship.


For example: I can show all User records that have Security Roles associated to it.


Now I want to create a Flow that updates all of the found User records.


How can this be archived?


Does Flow provide the possibility to use a similar filter?

Community Support
Community Support

Re: Query Dynamics 365 CE data with filter using n:n relationship

Hi @mgr,


Could you please explain more details about the n:n relationship that you mentioned?

Or could you please share a details example about your requirements?


Please share more details so we would try to provide a proper workaround for you.


Best regards,


Frequent Visitor

Re: Query Dynamics 365 CE data with filter using n:n relationship

I wanted to find out which of the Users within CRM (MsDyn365CE) do have at least one Security Role assigned.


Technically spoken the relationship between a System User and a Security Role ist set up by a hidden intersect entity called "Systemuserroles":


I found out now that you are able to query it with Flow by using the EntitySetName "systemuserrolescollection".

So this is wonderful! I created a Flow now which sets a flag on the User record as soon as he has a Security Role associated. I think I even could post all of the Security Role Names into a comma separated string into a  field of the User record.

Helpful resources


Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021


Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!


New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (7,508)