cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper V
Helper V

Determine if a user matches an entry in SharePoint

Hi All.

 

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?

3 REPLIES 3
Highlighted
Super User
Super User

Re: Determine if a user matches an entry in SharePoint

@hnguy71 

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:

If(
IsBlank(
LookUp(UserList, Lower(Approver_Level1A.Email) = Lower(User().Email)).Name),
"No",
"Yes"
)

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Highlighted
Helper V
Helper V

Re: Determine if a user matches an entry in SharePoint

Hi @RandyHayes 

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.... =(

Highlighted
Super User
Super User

Re: Determine if a user matches an entry in SharePoint

@hnguy71 

Something seems unusual.

Let's take a direct troubleshooting step:

Change the Tesxt property formula in your test label to this:

LookUp(UserList, ID=<someIDyouKnowHasAValue>).Approver_Level1A.Email

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.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

Helpful resources

Announcements
secondImage

New Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

August 2020 CYST Challenge

Check out the winners of the recent 'Can You Solve These?' community challenge!

Experience what’s next for Power Apps

Join us for an in-depth look at the new Power Apps features and capabilities at the free Microsoft Business Applications Launch Event.

Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,571)