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 / Auto populate people p...
Power Apps
Answered

Auto populate people picker field based on logged in user

(0) ShareShare
ReportReport
Posted on by 519

Hello,

I have a requirement to auto populate a people picker field - fieldname:  "First Level Reviewer" based on only certain logged in users on "New Form" and also disable that field so they cannot change it.  This is for only certain users, so for all other users the people picker field should not be auto populated.  They should be given the opportunity to include whichever name they want in that field, and it should also not auto disable for them even after they populate it.

 

My initial thoughts was to create a custom list in SharePoint to store the information of the logged in users in question, and I have two columns "Name" and "First Level Reviewer".  So the Name field should store the logged in users who I want the First Level Reviewer field to auto populate and disable for, and the First Level Reviewer field should be the name of the reviewer that is auto populated based on the logged in user.  I am also thinking that a list will be easier to maintain especially when users are acting or on vacation.  It could be updated easily instead of hard coding it into a formula.  

 

My challenge is, I am not sure if I am using the best approach, and also how to properly implement the above.  I would appreciate some guidance on this. 

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

    Hi @joshieboy 

     

    Based on your request, providing a solution for older post 😀

     

    Create a new SharePoint list called "Operations Reporting Table"

    StalinPonnusamy_0-1635461512376.png

    Set OnVisible property of AppStart to

     

    Set(UserInfo, User())

    Set the Items of First Level Reviewer Combo box to

    Choices('Operations Reporting Table'.'Direct Report')

     

    Set the DefaultSelecteditems Property of Combo box to

    If(
     !IsBlank(Parent.Default),
     Parent.Default,
     With(
     {
     _item: LookUp(
     'Operations Reporting Table',
     Name.Email = UserInfo.Email
     ).'Direct Report'
     },
     If(
     !IsBlank(_item),
     {
     Claims: "i:0#.f|membership|" & _item.Email,
     Department: "",
     DisplayName: _item.DisplayName,
     Email: _item.Email,
     JobTitle: "",
     Picture: ""
     }
    
     )
     )
    )

     

    Set the DisplayMode of the Combo box to

    With(
     {
     _item: LookUp(
     'Operations Reporting Table',
     Name.Email = UserInfo.Email
     ).'Direct Report'
     },
     If(
     !IsBlank(_item),
     DisplayMode.Disabled,
     Parent.DisplayMode
     )
    )

     


    Thanks,
    Stalin - Learn To Illuminate

  • joshieboy Profile Picture
    519 on at

    Hello @StalinPonnusamy - thank you. I am currently working on implementing this.  

    For this piece: Set (UserInfo, User()) - do I need to declare UserInfo somewhere?

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @joshieboy 

     

    Set that property on App OnStart like

    Set(UserInfo, User())

    StalinPonnusamy_0-1635790331472.png


    Thanks,
    Stalin - Learn To Illuminate

  • joshieboy Profile Picture
    519 on at

    Thank you @StalinPonnusamy  I made the change.  Completed the steps but nothing is populated for the first level reviewer field when I run it.  I have my name in the SharePoint list with a respective Direct Report but its showing as blank in the app.  Not sure what I'm doing wrong.  

  • joshieboy Profile Picture
    519 on at

    I initially had a variable set on start for Set(varUser,User()) and still included yours which I suppose was causing a conflict so removed it and used my original varUser and also made the changes in the formulas above to reference varUser instead of UserInfo, but that apparently is not the issue.

  • joshieboy Profile Picture
    519 on at

    Operations Reporting TableOperations Reporting TableWas doing some more troubleshooting and noticed that the records are not showing in PowerApps from the Operations Reporting Table.  I am just seeing [Record] but not the actual entries.

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @joshieboy 

     

    Person field type should display as [Record] like below

     

    StalinPonnusamy_0-1635794230202.png

     

    Looks like that record already has some data. Will try this. Please try to set DefaultSelectedItems Property to

     

    With(
     {
     _item: LookUp(
     'Operations Reporting Table',
     Name.Email = UserInfo.Email
     ).DirectReport
     },
     If(
     !IsBlank(_item),
     {
     Claims: "i:0#.f|membership|" & _item.Email,
     Department: "",
     DisplayName: _item.DisplayName,
     Email: _item.Email,
     JobTitle: "",
     Picture: ""
     },
     Parent.Default
     )
    )

     

     

  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @joshieboy 

     

    Here is the screenshot for reference

     

    StalinPonnusamy_0-1635803400539.png

    StalinPonnusamy_1-1635803419588.png

     

  • joshieboy Profile Picture
    519 on at

    Hi Stalin,

    My person field does display as [Record] similar to yours.

    Also attached is my DefaultSelectedItems which looks the same.  Your steps are very simple to follow but something is wrong on my end.

     

    defaulselecteditems.jpg
  • StalinPonnusamy Profile Picture
    Super User 2024 Season 1 on at

    Hi @joshieboy 

     

    Other troubleshooting items.

     

    • I assume varuser.email has a valid email instead of blank. Insert Label and set the Text property to

     

    varUser.Email

     

     

    • Insert another label and set the Text property to

     

    LookUp(
     'Operations Reporting Table',
     Name.Email = varUser.Email
    ).DirectReport.DisplayName

     

    StalinPonnusamy_0-1635825268652.png

     

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 221 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 188 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 120

Last 30 days Overall leaderboard