Skip to main content

Notifications

Power Apps - Building Power Apps
Unanswered

Using Lookup for people picker control

(0) ShareShare
ReportReport
Posted on by 4

I have a form where based on ID entered in a textbox (DataCardValue1), i need to extract the employee display name from another sharepoint list and show it up on the people picker field. I am trying to do a Lookup but i am unsure of the syntax. Please help.

Here is the code i am trying to write in default 

LookUp(SP DB,DataCardValue1.Text='ID').Employee

  • MVP-Phipps Profile Picture
    MVP-Phipps 3,447 on at
    Re: Using Lookup for people picker control

    Ok understood so you need to add the following:

    With(
     {_Employee: LookUp(SP DB,DataCardValue1.Text='ID',Employee)},
     {'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", 
     DisplayName:"", 
     Claims:"i:0#.f|membership|" & Lower(_Employee), 
     Department:"", 
     Email:_Employee, 
     JobTitle:"", 
     Picture:""}
    )

    You can leave some fields blank like picture etc... because they are not mandatory.

     

    Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful because this can help others.

    LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
    YouTube:
    https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg
    Twitter:
    https://twitter.com/phipps0218

  • BCBuizer Profile Picture
    BCBuizer 21,809 on at
    Re: Using Lookup for people picker control

    Hi @Sandeeprao8 ,

     

    In that case the code to make this wor depends on the format of the information that is stored in the Employee column. If it is saved as a mail address the below should work:

     

    With(
     {_Employee: LookUp(SP DB,DataCardValue1.Text='ID',Employee)},
     {'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser", 
     DisplayName:"", 
     Claims:"i:0#.f|membership|" & Lower(_Employee), 
     Department:"", 
     Email:_Employee, 
     JobTitle:"", 
     Picture:""}
    )
  • Sandeeprao8 Profile Picture
    Sandeeprao8 4 on at
    Re: Using Lookup for people picker control

    @phipps0218 Employee is stored as text in the database. On the form where i want to load the employee detail is a people picker control. And it wouldnt allow me to add any attribute to Employee whether be displayname or email. It give me the error. Hope this is clarifies.

  • MVP-Phipps Profile Picture
    MVP-Phipps 3,447 on at
    Re: Using Lookup for people picker control

    @Sandeeprao8 is Employee a People Picker? Can you do Employee.ID or Employee.Employee? If it is a people picker then it shouldn't be returning a text value. 

    Or it could be because you are saying the text value equals an ID which is a record value. Therefore rather than =ID you would need to do a lookup on a text value as well for example email...

  • Sandeeprao8 Profile Picture
    Sandeeprao8 4 on at
    Re: Using Lookup for people picker control

    Thanks @BCBuizer @phipps0218 for your response. 

    I am still getting the error message of incompatibility. Unable to convert.
    "The property on this control expects record values. the rule produces text values which are incompatible"

  • MVP-Phipps Profile Picture
    MVP-Phipps 3,447 on at
    Re: Using Lookup for people picker control

    @Sandeeprao8 , Do you get an error?

     

    Either of the following would work:

     

    LookUp(SP DB,DataCardValue1.Text='ID',Employee)

     

     

     

    LookUp(SP DB,DataCardValue1.Text='ID').Employee

     

     

    Please Accept as Solution if it solves your question. Or just give it a Thumbs Up if it is helpful because this can help others.

    LinkedIn: https://www.linkedin.com/in/charlie-phipps-%F0%9F%91%A8%E2%80%8D%F0%9F%92%BB-91338715b/
    YouTube: https://www.youtube.com/channel/UChmFBGU1YKIU91sNMQ7buGg
    Twitter: https://twitter.com/phipps0218

  • BCBuizer Profile Picture
    BCBuizer 21,809 on at
    Re: Using Lookup for people picker control

    Hi @Sandeeprao8 ,

     

    Your syntax seem correct.

     

    There is an alternative, but it's up to you to pick a way that suits your style:

     

    LookUp(SP DB,DataCardValue1.Text='ID',Employee)

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

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,691

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 65,019

Leaderboard