I have a collection called UserList which is pretty much an entire SharePoint list. In this collection I want to see if the current logged in user matches a person field called Approver_Level1. The idea is if the user is an approver then when the app is loaded the user automatically gets directed to a particular screen.
I have a text input field with this current code and it's not giving me any errors but the results are not correct:
If(IsBlank(LookUp(UserList, Approver_Level1A.Email = User().Email).Name), "No", "Yes")
To test, I have placed my name inside as an Approver yet it's telling me that I'm not found. Any ideas?
I understand what you are trying to do, but I'm not sure where you are doing this. You mentioned a text input field...are you stating that you have a TextInput control? What property are you putting this formula in?
As a quick test, I would do three things:
1) Refresh your datasources. You mentioned you added or changed to put your email in the list...did you do a refresh of that datasource in your app?
2) Put a Label control on the screen and set the Text property to the following formula:
LookUp(UserList, Lower(Approver_Level1A.Email) = Lower(User().Email)).Name),
3) Notice above that I added the Lower function to the two emails...probably not an issue, but it's always worth comparing apples to apples.
The above label should show "Yes" if you have yourself as an Approver_Level1A (please also note that you mentioned Approver_Level1 in your text, but your formula shows Approver_Level1A - I used the one from the formula) and you have refreshed the datasource.
I hope that leads to some success for you.
Thanks as always for the replies. To debug I am using a TextInput field and placing my formula in the Default property.
1. I did do a refresh after I added my name. I've tested with a few peers around me and none of them can see their names either.
2. I've created a label control and inside the text property it returns me a "No"
On a side note, my gallery to filter for items an approver can see is also blank:
Filter(MergedHighLevel, User().Email = UserRecord.Approver_Level1A.Email)
This should return all records in my collection but I don't see anything.... =(
Something seems unusual.
Let's take a direct troubleshooting step:
Change the Tesxt property formula in your test label to this:
Find an ID in your list that has a valid Approver_Level1A column you are testing with and substitute that in the blue above.
See if that returns anything you might expect or if it is blank. If is is blank, then we're going to need to go back a step and see what is going on in your Collection.
Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.
Check out the winners of the recent 'Can You Solve These?' community challenge!
Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.
Featuring samples like Return to the Workplace and Emergency Response Applications
Features releasing from October 2020 through March 2021