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
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

May UG Leader Call Carousel 768x460.png

June User Group Leader Call

Join us on June 28 for our monthly User Group leader call!

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.

PA.JPG

New Release Planning Portal (Preview)

Check out our new release planning portal, an interactive way to plan and prepare for upcoming features in Power Platform.

Top Solution Authors
Users online (3,245)