cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Resolver I
Resolver I

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

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

6 REPLIES 6
Community Support
Community Support

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.

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

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

 

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

Works perfect! THank you!

New Member

Hi, 

Thanks for the solution, is there any chance we only send email/ select  to single user, using 

rand(1,2), and set field called Selected on user list using Update item to set it Yes, so we not select this user again
by putting checkes before Get Item rand(1,2).
ask.PNG

 

many thanks
 

Helpful resources

Announcements
Microsoft Ignite

Microsoft Ignite

Join digitally, March 2–4, 2021 to explore new tech that's ready to implement. Experience the keynote in mixed reality through AltspaceVR!

New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (50,338)