cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
mennoov
Frequent Visitor

How to make a screen only visible for the logged in user?

Hello everyone,

 

I am developing an app in which employees can enter their hours for the past month. The photo that has been added is the page where an overview can be seen for the employee. At the moment everyone sees this overview (and therefore everyone each other's hours). I only want to make this page visible to the person who is logged in. This way everyone only sees their own hours. How do I do this?

The thing that is crossed out in blue is the name of the app.

 

I would like to hear from you!

6 REPLIES 6
adzocol
Helper I
Helper I

I would create a variable, varCurrentUser and set this to the current User

 

Set(varCurrentUser, User())

 

I would then use this to filter the records in the gallery. A full explanation is available here

 

 

eka24
Super User
Super User

First:

OnStart of the App create a Variable:

Set(MyLoggedUser, User().FullName)

Then replace the portion User().DisplayName='Created By' with 'Created By =  MyLoggedUser

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

mennoov
Frequent Visitor

Hi,

 

the first part succeeded, but with this part I still get errors.

 

Please see the added screenshot

Sorry because of missing one of the single quotes 

 

'Created By' =  MyLoggedUser

------------

If you like this post, give a Thumbs up. Where it solved your request, Mark it as a Solution to enable other users find it.

mennoov
Frequent Visitor

Hi, almost all errors are gone 😊. But there is still one error left. Please see the attachments.

 

Thanks in advance!

Hi,

 

While I agree with the technique above, we should never EVER use displayname for this, as this can result in data breaches when people have the same name as it will show records for all people with the name 'Firstname LastName', however we can use email address as more than one person cannot have the same email address within Microsoft Exchange, so they will always be unique.

 

User().Email should be used so that unique values are obtained.

 

Cheers,

Sancho

@iAm_ManCat


Please 'Mark as Solution' if someone's post answered your question and always 'Thumbs Up' the posts you like or that helped you!


Thanks!
You and everyone else in the community make it the awesome and welcoming place it is, keep your questions coming and make sure to 'like' anything that makes you 'Appy
Sancho Harker, MVP


Helpful resources

Announcements
UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Users online (1,388)