cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate II
Advocate II

Send Email to random users

Hello Everyone,

 

Anyone can help me on my problem?

When an item is created, a survey will be sent out to random users from my team. I have 17 people on my team and the survey should only be sent to 5 random people every time a new item is created. The 5 selected people should not be the same as the previous days. Is this possible in Flow?

 

Many thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: Send Email to random users

Hi @anabananei ,

 

Yes, this problem has been mentioned in my previous post, because the range of values is relatively small, so rand() function may get the same value.

And I use union() function to remove duplicate values, so you don't necessarily pick up five users.

I have improved it, please refer to the screenshot below for improvement.

 

Expression:

length(union(variables('Email'),variables('Email')))

10.PNG

 

11.PNG

 

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

5 REPLIES 5
Community Support
Community Support

Re: Send Email to random users

Hi @anabananei ,

 

What is currently achievable is to randomly extract five users, but there is no guarantee that these five people will not be duplicated, because Rand() function may get the same result in a small range.

What's hard to achieve is that the second time the user to be sent, the previous user needs to be excluded.

Because it is necessary to record the previous personnel, how to obtain it when the next execution of Flow is a difficult point.

 

Anyway, I created a flow that randomly selects five users, you could use it as a reference.

Create a list to record the user information, create a new Person type column to select user, and give each user a number, you could consider directly using ID as a number.

42.PNG

Flow configuration:43.PNG

 

44.PNG

 

45.PNG

 

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Highlighted
Advocate II
Advocate II

Re: Send Email to random users

Hi @v-bacao-msft ,

 

I have tried your flow and it works. The only problem is that instead of 5 results it only gives me 4. I mirrored your flow exactly. What do you think seems the problem?

 

Thank you,

ANa

Highlighted
Advocate II
Advocate II

Re: Send Email to random users

I tried changing the value of "minimum value" in random expression from 1 to 5 and it gave me 5 results. Do you think this is the correct workaround?

Flow_random.jpg

 

Highlighted
Community Support
Community Support

Re: Send Email to random users

Hi @anabananei ,

 

Yes, this problem has been mentioned in my previous post, because the range of values is relatively small, so rand() function may get the same value.

And I use union() function to remove duplicate values, so you don't necessarily pick up five users.

I have improved it, please refer to the screenshot below for improvement.

 

Expression:

length(union(variables('Email'),variables('Email')))

10.PNG

 

11.PNG

 

Please take a try.

 

Best Regards,

Community Support Team _ Barry
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

View solution in original post

Highlighted
Advocate II
Advocate II

Re: Send Email to random users

Works perfect! THank you!

Helpful resources

Announcements
firstImage

Now Live: Power Virtual Agents Community!

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

firstImage

New & Improved Power Automate Community Cookbook

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

thirdimage

Power Automate Community User Group Member Badge

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

Top Solution Authors
Users online (5,592)