@Anonymous
So my first question to you would be...don't you already have the department set up in the user profile?
If you do, then you can reduce the need for keeping a sperate list of emails and departments and you could use that to do all your filtering. Like this:
With({profileDept:Office365User.MyProfile().department},
SortByColumns(
Filter('[dbo].[wynne_TimeOff_PendingRequests]',
(
Dept = profileDept ||
profileDept = "HR" || profileDept = "Excutive"
) &&
Status="Approved"
),
"DateSubmitted", Descending
)
)
If you use what you have now instead of the User Profile, then you need to alter your formula to this:
With({departments: Filter(yourList, EmailAddress=User().Email)},
SortByColumns(
Filter('[dbo].[wynne_TimeOff_PendingRequests]',
Dept in departments.MgrDept &&
Status="Approved"
),
"DateSubmitted", Descending
)
)
Personally I like doing this off of the profile instead of a list. If a new person joins the company, they will have an account set up in 365, usually they will have their department set as well. That is all that is needed...your app does not need to be updated, nor do you need to add that user then to a list. It will just work.