cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
TimDemma
Helper I
Helper I

User Defined View function

Hello PowerApps wizards,

 

I'd like to have certain items in my app be visible to a designated user based on a SharePoint list. If the current logged-in user matches a specific Title Column's Assigned Role, they would have full access/visibility of other features within the app. All other users would not have the same access or visibility. (I hope that makes sense).

 

So, Item A(red box) is the current logged in user, Item B is the value of "Role Assigned 1" based off the dropdown value (Item C, in purple). Whichever Office365 User is assigned the role of "Scribe/Room Coordinator", should be able to view the Button to the left of A and B. The end goal is to use that same formula for lots of buttons and features throughout the app. 

 

TimDemma_1-1629995450207.png

 

Per usual, I'm sure there will be follow up questions to better understand my poor attempts at explaining my dilemma. So thanks in advance for the help!

 

3 REPLIES 3
zmansuri
Super User
Super User

Store current logged in user's department in a variable. 

Set button's Visible property to

Variable="Scribe/Room Coordinator"

 

button will be only visible to person who has this department

TimDemma
Helper I
Helper I

@zmansuri the issue I see with that method is that the person assigned to "Scribe/Room Coordinator" may change from time to time in the DateTable that is in the picture. It isn't a title that is linked to a current user's Office365 account in order to make it a variable. How can I set whatever value is in the "Scribe/Room Coordinator" Role Assigned 1 Column to a variable?

RandyHayes
Super User
Super User

@TimDemma 

This is fairly straightforward that you want to gather the permissions/roles of the user on startup and then utilize that in your app.

So, for example, in your OnStart:

Set(glbRole, LookUp('EOC People CheckList', StartsWith(UserEmail, User().Email), 'Role Assigned'))​

Then, assuming you have Scribe/Room Coordinator in the Role Assigned column for that user email (note, base your data on email, not display name - display name is not unique, but email is)

 

Then on your controls in the app, you can set the Visible property to formulas such as this:

   glbRole = "Scribe/Room Coordinator"

This would show that control for any user in that role.

 

NOW, this is all going to depend a lot on how you are storing your records in the People Checklist.

Will there be one role per person, or will there be multiple records in the list for a single person?

 

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up below. Solved your problem? - Click on Accept as Solution below. Others seeking the same answers will be happy you did.
NOTE: My normal response times will be Mon to Fri from 1 PM to 10 PM UTC (and lots of other times too!)
Check out my PowerApps Videos too! And, follow me on Twitter @RandyHayes

Really want to show your appreciation? Buy Me A Cup Of Coffee!

Helpful resources

Announcements
PA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

This training provides practical hands-on experience in creating Power Apps solutions in a full-day of instructor-led App creation workshop.

Microsoft Build 768x460.png

Microsoft Build is May 24-26. Have you registered yet?

Come together to explore latest innovations in code and application development—and gain insights from experts from around the world.

May UG Leader Call Carousel 768x460.png

What difference can a User Group make for you?

At the monthly call, connect with other leaders and find out how community makes your experience even better.

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