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

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.

3 REPLIES 3
Super User II
Super User II

@michaelpaul 

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?

 

-Ed-

Community Support
Community Support

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.

@edgonzales,

 

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

Announcements
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 (40,227)