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 / Optimize flow with mul...
Power Automate
Suggested Answer

Optimize flow with multiple conditions.

(1) ShareShare
ReportReport
Posted on by 64
The flow:
         I've written a flow that triggers when a form is submitted (Forms for Excel). The flow sends an email notification to the planner to create a work order for the part number and quantity provided in the form. The form also asks for a department, and this is what determines which planner receives the notification. In the Teams group for the planners, I have an excel workbook with a table of the departments, planner's name, and planner's email. The flow is composed of a bunch of conditions that verify which department is selected in the form response and to generate an email notification if true. I have a condition for each department (See image).
 
My question: Is there a more succinct way of writing this flow, or am I on the right track by having conditions for each department? I think it works fine for the number of departments that I'm working with, but I couldn't imaging writing out each scenario for a more complicated, or much larger communication chain. 
Categories:
I have the same question (0)
  • Suggested answer
    Nived_Nambiar Profile Picture
    18,129 Super User 2025 Season 2 on at
    Hi,
     
    Another way to try this is using OData filter query in List rows in table action, like filtering based on deprtment and then using the resultant data to get email id and send email see below for better idea
     
    Assume this is the excel table
     
    Now in the List rows present in table action, use below odata filter query to filter the excel table data with department column value
    Note - the column name used in Odata filter query shouldn't have spaces, else it will fail (only issue with excel actions)
     
    Now based on output of above actions, you can create condition action like below
    Expression used- 
    length(outputs('List_rows_present_in_a_table')?['body/value'])
     
    Now this expression checks whether there is any output from list rows in table action, if not it means such department value entered in form does not exists, else it is present.
     
    if it is present, it will follow Yes branch as shown below to send email
    Expression used above to capture email id - 
    first(outputs('List_rows_present_in_a_table')?['body/value'])?['Planner Email']
     
    Here i have used outlook connector to demonstrate sending email - but the logic is same :)
     
    overall flow looks like
     
    Now you don't need to create condition for every department as it is not best practice.
     
    for more details on Odata filter query for usage in List rows in table action - refer below
     
    Thanks & Regards,
    Nived N 
    LinkedIn: Nived N's LinkedIn
    YouTube: Nived N's YouTube Channel
    Blog: Nived Nambiar's Blogs
     Found my answer helpful? Please consider marking it as the solution!
     Your appreciation keeps me motivated. Thank you!

     

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 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard