web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Send emails with multi...
Power Automate
Suggested Answer

Send emails with multiple documents at different location in SP to different department

(2) ShareShare
ReportReport
Posted on by 49
Hi,
 
I'm looking for suggestions to design a flow with below condition:
 
Send email with 2 documents located at different locations on SP to number of people who belong to different departments.
 
I have designed multiple flows which does the task, however I'm not sure if it is the most efficient method to accomplish this task. This is due to the limitations on the number of nested conditions (i.e. 8) you can have in a flow.
 
Instead of running multiple flows, I'm looking for a solution where I could run a single flow to get this done.
 
 
Appreciate your assistance in advance.
 
Thanks
Categories:
I have the same question (0)
  • Expiscornovus Profile Picture
    33,195 Most Valuable Professional on at
     
    What are you checking in the conditions? Is it the same field, but just a different value?
     
    In that case (pun intended) you might be able to use a switch action instead of all those nested condition actions.
     
    Additionally, you might want the look into the usage of variables. I see a lot of actions are pretty similar.
     
     
    Happy to help out 😁

    I share more #PowerAutomate and #SharePointOnline content on my Blog, LinkedIn, Bluesky profile or Youtube Channel
  • Suggested answer
    stampcoin Profile Picture
    5,058 Super User 2025 Season 2 on at
    Please consider using Switch and Scope +child flows for your flow.
    Here are the links you need to optimize it
     
    feel free if you have any questions.
  • Suggested answer
    Ellis Karim Profile Picture
    11,684 Super User 2025 Season 2 on at
     
    First, please have a look at the SWITCH action, to replace the 7 condition actions.
     
     
     
    Ellis Karim
    Ellis Karim
    Blog | LinkedIn | Bluesky
    If this solved your issue, please mark it as ✅ Accepted Answer. If it helped, feel free to give it a 🩷 Like!
  • Suggested answer
    Tomac Profile Picture
    3,950 Moderator on at
    I think the best way to clean this up is to evaluate what's changing in the results of each Condition action and use variables to store those values. Then use Switch statements to set those variables correctly before running your set of actions (SharePoint, OneDrive, Excel) a single time instead of recreating the actions in every Condition.
     
    Here's a quick and dirty sample that doesn't account for your specific case because I don't know what your Condition actions are comparing:
     
    If this sample helped resolve your issue, please mark it as the answer.
  • CU30050649-1 Profile Picture
    49 on at
    This is the data I'm working on to identify records based on Institution, Team and Sub-Team to send the email and documents from SP.
     
  • CU30050649-1 Profile Picture
    49 on at
     
    This is one of the condition, so I check for institution, team and sub-team and accordingly attach the PDF from SP on to an email. This condition changes as per the list I've uploaded here. There could be one or multiple people assign for the sub-team, hence the list will be longer.
  • Suggested answer
    Tomac Profile Picture
    3,950 Moderator on at
     
    You'll need to nest Switch actions to get your desired outcome without running into the 8 level limit. Something like this (open the image in a new tab or download it to see it bigger):
     
    It won't look as pretty as nested Conditions, but it's what you'll need to do in order to accomplish your goal.
  • CU30050649-1 Profile Picture
    49 on at
     
    I have designed a flow as suggested, however when the sub-team has a null value, it fails even after declaring a variable to address the null. I have attached a screenshot of the flow with the error message. 
     
    Is there another way to tackle this issue?
     
    Thanks in advance.
     
  • Suggested answer
    Tomac Profile Picture
    3,950 Moderator on at
    Switch actions can only work with Integer and String types. It doesn't handle Null values, so you'll need to test for Nulls before your first Switch. It may be best to build a secondary array from your source Excel file using Select and the coalesce() function and then check your Switch cases against that array instead of the Excel:
     
    In my Select action, I'm using this function to turn a Null value into an empty text value, but you can put any test you want in there to mark no value:
    coalesce(items('Apply_to_each')?['email_ID'],'')
     
    Then I'm running my Switch actions against the values from my Select action rather than the values from the List Rows action, and will no longer need to worry about Null values.
     
     
  • CU30050649-1 Profile Picture
    49 on at
     
    Thanks.
     
    I'm following the steps as mentioned.
     
    Can I have the output function under Switch action from your screenshot please? 
     
    I have added a select action, however when I try to get the output within Switch, it displays an error.
     
     
    Cheers

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard