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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / lookup won't return th...
Power Apps
Unanswered

lookup won't return the right results for user access level management

(0) ShareShare
ReportReport
Posted on by 142

I want to block off parts of my powerapp using roles which I will manage in a sharepoint list.

 

In the list I have a People column named "Name" in which I search the contact card for those in the organisation.

The next column is a choice column named "Access Level" with these three options: Developer, Coordinator, Client.

 

On the app's OnStart I have the following code:

 

 

Set(isDev, !IsBlank(LookUp('User Access Levels', Name.Email = User().Email && 'Access Level'.Value="Developer")));
Set(isCoord, !IsBlank(LookUp('User Access Levels', Name.Email = User().Email && 'Access Level'.Value="Coordinator")));
Set(isClient, !IsBlank(LookUp('User Access Levels', Name.Email = User().Email && 'Access Level'.Value="Client")));

 

 

Then, on a text label I'm using as a test I have set the Visible parameter to be one of the three variables, e.g. isDev - but it won't return it even though my role on the sharepoint list is set to Developer.

 

I have tried all three variables as well as nesting the IsBlank in an IF Statement, but to no avail.

 

I also want to do it so that the Developers can see everything, while the Coordinators are limited to some things and Clients are even further limited in terms of visibility.

 

Thanks in advance.

Categories:
I have the same question (0)
  • Daniel Bocklandt Profile Picture
    5,099 Super User 2025 Season 2 on at

    Try to put this in a Gallery so you can see wether the first part of the Lookup poses problem

    LookUp('User Access Levels', Name.Email = User().Email)

    If this returns the expected record try this formula

    LookUp('User Access Levels', Name.Email = User().Email && 'Access Level'.Value="Developer")

    If this also works as expected, try putting this formula in a text label text property

    If(!IsBlank(LookUp('User Access Levels', Name.Email = User().Email && 'Access Level'.Value="Developer")),"True","False")

    If this also works fine try putting the formula from OnStart to the Screens OnVisible

  • aantoniou Profile Picture
    142 on at

    Thanks for your response. After trying this it turns out that because our organisation has two sets of emails for each user, it is cross-checking two different strings and finding that they don't match.

    We have an email which is name.surname@organisation.com and another which is userID@organisation.com. They both pertain to the same account so it's quite frustrating that this is happening:

    Name.Email is returning name.surname@organisation.com
    User().Email is returning userID@organisation.com

     Is there a way around this? I can always use DisplayName and FullName but as soon as we have two users with matching names then I will have an issue.

  • Daniel Bocklandt Profile Picture
    5,099 Super User 2025 Season 2 on at

    Can you find the User ID anywhere in the data that you get back from the office365Users connector?

  • aantoniou Profile Picture
    142 on at

    How do I go about doing that? Apologies, I haven't worked with user account management before. I just have a Sharepoint column with the user card in there and was looking up the email information from the account.

     

    The options under User(). are: Email, FullName or EntraObjectId.

    The options under Name. include: Claims, Department, DisplayName, Email, JobTitle, Picture.

  • Daniel Bocklandt Profile Picture
    5,099 Super User 2025 Season 2 on at
    Set(varProfile,Office365Users.MyProfile())

    you need to add the Office365Users connector to your app and just put this inside a Button. Then you can check if inside the answer there is anywhere the UserID that you need to find the Email in question

  • Verified answer
    aantoniou Profile Picture
    142 on at

    So I found that Office365Users.MyProfile().UserPrincipalName returns the ID but seeing as it's not connected to the user cards in the sharepoint list, it isn't actually crosschecking with the records there?

     

    if I do this then it's just checking the current user email twice isn't it?

    Set(isDev, !IsBlank(LookUp('User Access Levels', varProfile = User().Email && 'Access Level'.Value="Developer")));

     

    Alternatively, I could do

    Set(varProfile,Office365Users.MyProfile().Mail); //find the name.surname email
    Set(isDev, !IsBlank(LookUp('User Access Levels', Name.Email = varProfile && 'Access Level'.Value="Developer"))); 
    //cross-check for name.surname emails instead of ID emails

    It seems that both User(). and Name. don't contain enough information for them to be matched, so I've had to use the name.surname emails. Considering that these are also unique I think it should be okay. Thanks for your help!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 717 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard