cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
NielsL
Helper V
Helper V

Get list of unique users from list records in CDS

End goal:  Get a list of unique users to send an email to. 

 

I have a flow that runs the last day of every month and creates a bunch of records in CDS. Each user might have several records, where they are the owner. 

 

I'm trying to come up with a way to get a list of unique users, so that every user will only get one email - and not an email for every record created. 

 

If I use a List records action and then get records action for each user, the I'll end up with duplicates:

 

Capture.PNG

 

I've been playing around with Arrays and the Union function but I haven't found a way to get it to work. 

 

Any input is appreciated 😊

1 ACCEPTED SOLUTION

Accepted Solutions
abm
Super User
Super User

Hi @NielsL 

 

You could try constructing a  fetchxml (Main entity as Users) with inner join (with other entity) using 

 <fetch mapping='logical' distinct='true'>

 

To execute the FetchXML you need to use CDS current environment connector. In order to get this connector you need to create a solution first and then create a flow from the solution.

 

See this post might help

 

https://www.itaintboring.com/dynamics-crm/two-most-ignored-features-of-fetchxml/

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

View solution in original post

2 REPLIES 2
abm
Super User
Super User

Hi @NielsL 

 

You could try constructing a  fetchxml (Main entity as Users) with inner join (with other entity) using 

 <fetch mapping='logical' distinct='true'>

 

To execute the FetchXML you need to use CDS current environment connector. In order to get this connector you need to create a solution first and then create a flow from the solution.

 

See this post might help

 

https://www.itaintboring.com/dynamics-crm/two-most-ignored-features-of-fetchxml/

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog
Power Automate Video Tutorials

@abmthanks for the help. 

 

I was actually trying not to create the flow in my solution, as the ALM-story for flows really sucks at the moment (e.g. you need to manually re-active connections when you move from one environment to another).

 

However, everything is just so much easier with FetchXML compared to OData filter query. 

 

Cheers 

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

365 EduCon 768x460.png

Microsoft 365 EduCon

Join us for two optional days of workshops and a 3-day conference, you can choose from over 130 sessions in multiple tracks and 25 workshops.

Users online (2,843)