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 Apps / Lookup field to displa...
Power Apps
Answered

Lookup field to display user

(0) ShareShare
ReportReport
Posted on by 728
How can I pre-populate a lookup field in my form to display current logged in user?

Thanks
Categories:
  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    Hi @neill_long,

     

    Check out the User() function Is uses the current user's account information as follows

    User().EmailEmail address of the current user.
    User().FullNameFull name of the current user, including first and last names.
    User().ImageImage of the current user. This will be an image URL of the form "blob:identifier". Set the Image property of the Imagecontrol to this value to display the image in the app.
  • neill_long Profile Picture
    728 on at
    I tried User().FullName but it didn't work.

    As it's a lookup field, it's linking to another list and currently displays as a dropdown. I tried:

    If(OrderForm.Mode = New, {'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", Claims:Concatenate("i:0#.f|membership|",User().Email),DisplayName:User().FullName,Email:User().Email},First(ThisItem.StaffName))

    This didn't work either. Any more suggestions?
  • Verified answer
    v-xida-msft Profile Picture
    Microsoft Employee on at

    Hi @neill_long,

    Do you want to set a default value for the Lookup type column or a Person type column within the Edit form?

     

    I have made a test on my side, please take a try with the following workaround:

    If you want to set a default value for the Person type column within the Edit form, please set the DefaultSelectedItems property of the Combo box control to following formula:

    If(
    EditForm1.Mode=FormMode.New, { Claims: "i:0#.f|membership|" & User().Email, DisplayName: User().FullName } )

    5.JPG

     

    If you want to set a default value for the Lookup type column within the Edit form, please set the DefaultSelectedItems property of the Combo box control to following formula:

     

    If(
     EditForm1.Mode=FormMode.New,
     {
     '@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Id:LookUp('20180925_case12_1',PreName=User().FullName,ID),
     Value:User().FullName
     }
    )

    Note: The '20180925_case12_1' represents the list (another list you mentioned) the Lookup column references values from. The PreName represents the column within the '20180925_case12_1' SP list the Lookup column references values from.6.JPG

    More details about setting a default value for a Lookup type column of a SP list, please check the following blog:

    https://powerusers.microsoft.com/t5/Creating-Apps/Sharepoint-list-lookup-and-default-value-in-a-form/td-p/83869

     

    Please also check and see if the following blog would help in your scenario:

    https://powerapps.microsoft.com/en-us/blog/default-values-for-complex-sharepoint-types/

     

    Best regards,

    Kris

     

  • neill_long Profile Picture
    728 on at

    @v-xida-msft it's a lookup field not a person.  I tried what you suggested and it worked!

     

    thanks very much

     

    Alistair

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

    Hi @neill_long,

    Have you solved your problem?

     

    If you have solved your problem, please go ahead to click "Accept as Solution" on the reply that contains the solution so that this thread will be marked for other users to easily identify.

     

    Best regrds,

    Kris

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 232 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 202 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 122

Last 30 days Overall leaderboard