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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Setting admin by the v...
Power Apps
Unanswered

Setting admin by the value in sharepoint list

(0) ShareShare
ReportReport
Posted on by 290

Hey! I have this sharepoint list 

employees.png

 

And I want to set admin right to everyone, that has position "Manager".

I have tried this, but it does not work

If(User().Email in Employees.NameOfEmployee && User().Position = "Manager", Set(isAdmin,true),Set(isAdmin,false));

I just want to basically set isAdmin true, if email (NameOfEmployee column) has in the Position column written "Manager".

 

Could someone help please?

Categories:
  • Ramole Profile Picture
    Super User 2024 Season 1 on at

    Hi @Filistyn 

     

    Add this App OnStart  

     

     

    Collect(
     Who,
     Employees
    );
    Set(
     varWho,
     LookUp(
     Who,
     Employees.DisplayName = User().FullName,
     Employees.DisplayName
     )
    );

     

     


    And reference this Example Add Visible etc

     

     

     

    If(varWho=User().FullName,true,false)

     

     

     

     

  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    Hi @Filistyn ,

    Try this

    Set(
     isAdmin,
     LookUp(
     Employees,
     NameOfEmployee = User().Email
     ).Position = "Manager"
    )

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

  • Filistyn Profile Picture
    290 on at

    I think it does not work, since I'm trying to show/hide button based on this condition

    If(isAdmin, true, false)

    and me as a manager can't see the button

  • Filistyn Profile Picture
    290 on at

    Does not work 😞

  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    @Filistyn ,

    You do not have to specify true or false for either the variable setting or the Visible - it is inferred based on whether the statement is true or false so: -

    Set(
     isAdmin,
     LookUp(
     Employees,
     NameOfEmployee = User().Email
     ).Position = "Manager"
    )

    sets the Variable isAdmin to either true or false depending  on whether the result of looking up the Employee List, finding the record (if one exists) where the NameOfEmployee matches the user's email, then looking at the Position field in this record and seeing if it is Manager. If so, isAdmin will be true - if not (or no record found), it will be false.

    Also for the Visible of the button, you just need

    isAdmin

    as this will be either true or false and will set the Visible the same.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

     

  • Filistyn Profile Picture
    290 on at

    Thank you for the answer, 

     

    my email is in the Sharepoint list set as "Manager" in the Position column. Still if I try the piece of code you have posted here, isAdmin value is False. I have refreshed my sharepoint list, tried it even as a different user, but isAdmin is still False 😞

  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    @Filistyn ,

    Is there only one record in the list with your email in the NameOfEmployee column (a Lookup will find the first matching record).

    I have also just tested the syntax on a list here and returned true when I set the field content to match the first record with my email in the looked up field (and I use the pattern myself frequently).

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

     

     

     

     

     

  • Filistyn Profile Picture
    290 on at

    Can you link the sharepoint list and also the powerapp please? cuz it's still not working for me

  • WarrenBelz Profile Picture
    156,748 Most Valuable Professional on at

    @Filistyn ,

    If it gives no error, you need to check your data. As a test, put this on a Label as the Text

    LookUp(
     Employees,
     NameOfEmployee = User().Email
    ).Position

    If it does not return Manager, then it is a data issue.

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

     

  • Filistyn Profile Picture
    290 on at

    It does return Manager.

     

    Why is then admin still false?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 339 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 289

#3
Mohsin Ali Profile Picture

Mohsin Ali 228

Last 30 days Overall leaderboard