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

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Get Name from Username...
Power Automate
Unanswered

Get Name from Username and Save it to a global variable

(0) ShareShare
ReportReport
Posted on by 39

I am creating a login page. the user puts in the username and password and clicks on the button "login". when he clicks on login, i want the PowerApps to go to the SharePoint, get the name from the list where username = username entered and save the result in a global variable

Categories:
I have the same question (0)
  • v-dezhili-msft Profile Picture
    Microsoft Employee on at

    Hi @ESAIT ,

    1. You just want to save the username to a global variable or a record of the username when the user logs in?
    2. Is the user in your SharePoint table a person column?
    3. Do you have a Password column in your SharePoint table?
    In fact, there is a built-in global variable User() in Power Apps, which stores the information of the current Power Apps user. I did a test, in my scenario the user in my SharePoint table is a person column and I have a Password column. When I click on the login button I use filter() to find the username in sharePoint that is the same as the text input box, and compare the Password, if they are equal I use set() to save the username.

    If(TextInput4.Text=First(Filter(list3,person.DisplayName=TextInput3.Text)).Password,Set(glo,TextInput4.Text);Navigate(Screen6),Notify("error"))

    Best Regards,

    Dezhi

  • ESAIT Profile Picture
    39 on at

    @v-dezhili-msft thank you for your assistance 

    1. i want to save the name to display it in the next screen and to use it in future queries

    2. Yes there is a username, password, first name, and last name

    3. yes 

     

    i will test what you sent me and update you. thank you 😀

  • ESAIT Profile Picture
    39 on at

    @v-dezhili-msft I checked the code now and it is similar to the one i used to check if the username and password exist in the sharepoint, yet i need to fetch the Name based on the username and save the name in the global variable

  • v-dezhili-msft Profile Picture
    Microsoft Employee on at

    Hi @ESAIT ,

    Do you want to get the FullName of this user from the SharePoint table by Username when logging in?
    In my test my UserName, FirstName and lastName are all of type single line text in SharePoint table.

    If(TextInput3.Text=First(Filter(list3,UserName=TextInput3.Text)).UserName,Set(varName,First(Filter(list3,UserName=TextInput3.Text)).LastName&First(Filter(list3,UserName=TextInput3.Text)).FitstName))
    vdezhilimsft_0-1667200041041.png
    vdezhilimsft_1-1667200041042.png
    vdezhilimsft_2-1667200041043.png

    Best Regards,

    Dezhi

  • ESAIT Profile Picture
    39 on at

    @v-dezhili-msft thank  you for your assistance

    i Named my columns same as your code with family name as LastName and First Name as FirstName

    but Power App is not accepting them as per the attached

    PowerApp.jpg
  • v-dezhili-msft Profile Picture
    Microsoft Employee on at

    Hi @ESAIT ,

    Did you refresh the data source in Power Apps after you changed a field in a SharePoint list? You can also go to List Settings to see if the list names have been changed correctly.

    Best Regards,

    Dezhi

  • ESAIT Profile Picture
    39 on at

    @v-dezhili-msft thank you dear there is no longer an error, but when i click on login for the next page, 

     I need on a screen load to have that name that was saved on the global variable to be shown automatically on top filling a label. when i click on the label, and choose text = global variable, it keeps returning as blank

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 293

#2
David_MA Profile Picture

David_MA 262 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 223 Most Valuable Professional

Last 30 days Overall leaderboard