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
Power Platform Call June 2022 768x460.png

Power Platform Community Call

Join us for the next call on August 17, 2022 at 8am PDT.

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.

Users online (2,842)