web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Displaying the name of...
Power Apps
Unanswered

Displaying the name of the logged in user

(0) ShareShare
ReportReport
Posted on by 35

I have built the following login screen. I would like the name (from list) of a given user to be displayed on his screen after logging in. How can I do this.

Set(
 teacherRecord,
 LookUp(
 teachers,
 email = txtEmail.Text
 )
);

Set(
 studentRecord,
 LookUp(
 students,
 email = txtEmail.Text
 )
);

If(
 IsBlank(teacherRecord) && IsBlank(studentRecord),
 Notify("Username not found", NotificationType.Error)
);

If(
 !IsBlank(teacherRecord),
 If(
 teacherRecord.password = txtPassword.Text,
 Navigate(home_screen_teachers),
 Notify("Incorrect password", NotificationType.Error)
 )
);

If(
 !IsBlank(studentRecord),
 If(
 studentRecord.password = txtPassword.Text,
 Navigate(home_screen_students),
 Notify("Incorrect password", NotificationType.Error)
 )
)

 

Categories:
I have the same question (0)
  • Pstork1 Profile Picture
    68,729 Most Valuable Professional on at

    You can get the display name of the logged in user using user().Fullname.  If you are having people login to your app while running the app under a different user account that would violate the licensing terms for Power Apps. Each user using the app must have an appropriate license.  So there is usually no reason to have a login screen in the app since the user has to login to use the app itself.

  • CU-18081211-6 Profile Picture
    9,270 Moderator on at

    @cporzeczkowe ,

    You have already this information inside teacherRecord /studentRecord global variables. 

    So, all you need to do is to use in Text property of a label (home_screen_teachers /home_screen_students), the reference to Name column, like teacherRecord.Name

    (where Name is the column name you keep the name of the teacher/student).

     

    Please note that this approach (use a logging screen) is against Microsoft regulation and you should reconsider your solution from the start. 

     

    Hope it helps !

  • cporzeczkowe Profile Picture
    35 on at

    Thanks for letting me know about the microsfot regulations. how can I transform this solution so that after logging in from the student's account (emial address). the student only saw his part of the application and similarly with the teacher.

  • Pstork1 Profile Picture
    68,729 Most Valuable Professional on at

    When the student logs in and runs the application their email address and name are available using a function called User().  You can retrieve the email address in the App.OnStart event or in the OnVisible event on the first screen and store it in a variable.  You can then use that to lookup a value in a list to find out whether they are a teach or a student.

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard