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 / Restrict access to screen
Power Apps
Unanswered

Restrict access to screen

(0) ShareShare
ReportReport
Posted on by 225

I have a sharepoint list called "Users" with 2 columns "Name (People type)" and "Role (Choice Type)".  The rows are then peoples names and for the "Role" column, "User" or "Admin".  

 

How can I restrict a screen so that only "Admin" can access it?  I have watched and read lots of stuff on the web, but cant find anything to help me with my scenario.

 

How can i achieve the above? Thanks in advance.

Categories:
I have the same question (0)
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @StuartSmith 

    In the OnStart property of the app,

    Set(UserName, User().FullName);

    Set(UserRole,Lookup(Users, Name.Value=UserName).Role.Value

    Assuming the screen is named Screen1,

    Have a button or icon on any other screen where you want an admin to be able to access Screen1

    set its OnVisible property to UserRole="Admin" and its OnSelect property to Navigate(Screen1)

     

     

     

     

  • StuartSmith Profile Picture
    225 on at

    Thanks for getting back to me so quickly.

    For the code: Set(UserRole,Lookup(Users, Name.Value=UserName).Role.Value) i get the below error...

    2022-05-28_18-21-11.jpg

    and then the question about a button or icon, I already have a menu bar on all the screens showing an "Administration" buttons.  Is is possible to keep it visible and have it disabled if "User" and enabled if "Admin".

    2022-05-28_18-26-08.jpg

     

    Thanks in advance 

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @StuartSmith 

    The error is because you already have context variables with the same name as the global variables.   In any event, if you have a way of assigning the role to the user of the app using a variable like varRole, then you can use the DisplayMode  property of the button:  If(varRole="Admin",Edit,Disabled)

  • StuartSmith Profile Picture
    225 on at

    Sorry, fairly new to Power Apps so unsure what you mean about why I am getting the error. How can I fix it as would really like to restrict access to the "Admin" screen.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 529 Most Valuable Professional

#2
Haque Profile Picture

Haque 230

#3
Kalathiya Profile Picture

Kalathiya 217 Super User 2026 Season 1

Last 30 days Overall leaderboard