Hello! I can't come up with a filter, could somebody help me?
I have this sharepoint list
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?