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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Filtering sharepoint list
Power Apps
Answered

Filtering sharepoint list

(0) ShareShare
ReportReport
Posted on by 290

Hello! I can't come up with a filter, could somebody help me?

 

I have this sharepoint listdata.png

I'm working on a Time Off app and I want to send an email to a certain position. By that I mean:

 

  • If there is no Team Leader in the department, time off requests are being accepted by Manager only. So email will be send to Manager
  • If there is a Team Leader in the department, Team Leader accepts Employee's requests BUT Manager accepts Team Leader's requests. So if Employee asks for a Time off, Team Leader will get the email and if Team Leader asks for a Time off, manager will get the email.

 

My code looks like this:

 

 

If(
 varTeamLeader,
 Office365Outlook.SendEmail(
 LookUp( 
 Employees,
 Department = varMyDept && Position = "Team Leader"
 ).NameOfEmployee,
 "Vacation request",
 "New Vacation request from: " & User().FullName
 ),
 varTeamLeader = false,
 Office365Outlook.SendEmail(
 LookUp(
 Employees,
 Department = varMyDept && Position = "Manager"
 ).NameOfEmployee,
 "Vacation request",
 "New Vacation request from: " & User().FullName
 ),
 LookUp(
 Employees,
 NameOfEmployee = User().Email
 ).Position = "Team Leader",
 Office365Outlook.SendEmail(
 LookUp(
 Employees,
 Department = varMyDept && Position = "Manager"
 ).NameOfEmployee,
 "Vacation request",
 "New Vacation request from: " & User().FullName
 )
 )

 

 

 

varTeamLeader is true, if there is a Team Leader in the department. varMyDept is a department of the logged user.

 

Could somebody help me?

Categories:
I have the same question (0)
  • CU-18081211-6 Profile Picture
    9,270 Moderator on at

    @Filistyn ,

    Here is my thoughts. Please note that you really need a column in Sharepoint list to keep the EmployeeEmail (I already used it in my code), because the Outlook connector use email addresses, not names to send emails.

     

    With(
     {myDepEmployees:Filter(Employees,Department = varMyDept)},
     With({responsablePerson:
     Coalesce(
     LookUp(
     myDepEmployees,Position = "Team Leader" && !(User().Email = EmployeeEmail)).EmployeeEmail, 
     LookUp(
     myDepEmployees,Department = varMyDept && Position = "Manager").EmployeeEmail
     )
     }
     ),
     Office365Outlook.SendEmail(
     responsablePerson,
     "Vacation request",
     "New Vacation request from: " & User().FullName
     )
    )

     

     Give it a try !

    Hope it helps !

  • Verified answer
    Filistyn Profile Picture
    290 on at

    Hey, thank you for the answer! I have fixed with this code:

    If(
     varTeamLeader,
     If(
     pozice = "Manager",
     Office365Outlook.SendEmail(
     LookUp(
     Employees,
     Position = "Admin"
     ).NameOfEmployee,
     "Vacation request",
     "New Vacation request from: " & User().FullName
     ),
     pozice = "Team Leader",
     Office365Outlook.SendEmail(
     LookUp(
     Employees,
     Department = varMyDept && Position = "Manager"
     ).NameOfEmployee,
     "Vacation request",
     "New Vacation request from: " & User().FullName
     )
     ),
     Office365Outlook.SendEmail(
     LookUp(
     Employees,
     Department = varMyDept && Position = "Team Leader"
     ).NameOfEmployee,
     "Vacation request",
     "New Vacation request from: " & User().FullName
     ),
     varTeamLeader = false,
     If(
     pozice = "Manager",
     Office365Outlook.SendEmail(
     LookUp(
     Employees,
     Position = "Admin"
     ).NameOfEmployee,
     "Vacation request",
     "New Vacation request from: " & User().FullName
     ),
     Office365Outlook.SendEmail(
     LookUp(
     Employees,
     Department = varMyDept && Position = "Manager"
     ).NameOfEmployee,
     "Vacation request",
     "New Vacation request from: " & User().FullName
     )
     )
    );

     

    I forgot to mention, that Manager is getting approved by admin 

  • Filistyn Profile Picture
    290 on at

    Also NameofEmployee is an email address, again I forgot to mention that, sorryyy

  • v-albai-msft Profile Picture
    Microsoft Employee on at

    Hi @Filistyn ,

    Since your issue is resolved, you can mark your reply as a solution. This will benefit other users in this community who meets same issue, so that they can directly see my solution when search same issue.

    Best regards,

    Allen

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
Haque Profile Picture

Haque 84

#2
WarrenBelz Profile Picture

WarrenBelz 79 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 40 Super User 2026 Season 1

Last 30 days Overall leaderboard