Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Is there a simpler way?

I am building a few flows that need the same basic funtionality. Basically I am wanting to pull emails from an SP list based on a role assigned to each person. Essentially the list is three columns


Name - Role - Email


The way that I have my flow created works however because I have to duplicate this accross multiple flows I am wondering if there is a better way of doing this. Essentially my flow is:

  1. Get Items from list
  2. Initialize variable for role 1 
  3. Initialize variable for role 2
  4. Initialize variable for role 3
  5. Initialize variable for role 4
  6. Initialize variable for role 5
  7. Initialize variable for role 6
  8. Apply to each (Get Items - Value)
    1. Switch - 'Role Value'
      1. Case 1 = Role 1 
        1. Append to String Variable Role 1 - 'Email';
      2. Case 2 = Role 2 
        1. Append to String Variable Role 2 - 'Email';
      3. Case 3 = Role 3 
        1. Append to String Variable Role 3 - 'Email';
      4. Case 4 = Role 4 
        1. Append to String Variable Role 4 - 'Email';
      5. Case 5 = Role 5 
        1. Append to String Variable Role 5 - 'Email';
      6. Case 6 = Role 6 
        1. Append to String Variable Role 6 - 'Email';
  9. I can then use one of the Variables as required to insert emails into my flows.

I know that there is a role functionality built into 365 users however this wont work in my situation. any ideas would be helpful.

Super User
Super User

Re: Is there a simpler way?


Hi there - So, if a person has multiple roles...are there multiple rows for the same person?  Or is there a delimiter of some kind?



Community Support Team
Community Support Team

Re: Is there a simpler way?

Hi @michaelpaul,


Your final goal is that sends the corresponding emails according to the items' Role value, right?

Maybe you have no need to get each user's email and store it, you can directly use the Filter query in the Get Items action, just like the following picture shows:Annotation 2019-08-21 132849.png

Please have a try, I hope it can help you.

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

Level: Powered On

Re: Is there a simpler way?



In the Roles list there will be a seperate row for each role so a person may be on multiple rows.


Also thank you @v-litu-msft 


I have done it that way a few times as well if my flow is smaller or I only need to create one 'email list' and it also works well, however I have found more success building an 'email list string variable' within an 'Apply to Each' if i need to use that email list multiple times within a flow. That said, if I'm having to create multiple 'email lists' within a single flow, I don't really find one method more efficient than the other since I would still have to either have multiple 'Get Items', 'Conditions', or a Switch. 

Helpful resources


Power Automate Community User Group Member Badge

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


Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!


Microsoft Learn

Learn how to build the business apps that you need.


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors
Users Online
Currently online: 312 members 6,285 guests
Please welcome our newest community members: