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 Apps
Answered

People picker help

(0) ShareShare
ReportReport
Posted on by 576

I have an app with a text field that is autoassigned a value consisting of last name, first name as it would appear in Active Directory. However, it's not a people picker field, only text. I have another field where I want to use the value of the text field to query the Office 365 connection using the first field value and return the email associated with that name. Is that possible?

 

Thanks.

Categories:
  • Verified answer
    rsaikrishna Profile Picture
    3,703 on at

    @ahhollan 

     

    How are you auto assigning the first field with Last Name and Firstname ? Are you getting the currently logged in user information?

     

    If so, place the currently logged user in a variable Set(varUser, Office365Users.MyProfile()) and use varUser.Mail property to get email address.

     

    This way, you can set the value of 2nd text field with email directly instead of querying again.

     

    Regards

    Krishna Rachakonda

    If this reply helped you to solve the issue, please mark the post as Accepted Solution. Marking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

     

     

  • ahhollan Profile Picture
    576 on at

    No. The logged in user isn't usually the person whose name needs to be in the field. It is auto assigned based on another SharePoint list with regional assignments. 

  • Verified answer
    SaiKrishnaGudluru Profile Picture
    499 on at

    @ahhollan to achieve this you may need to consider two points...

     

    1. may not receive exact values with the first name and last name values
    2. to achieve correct data, the Search Field should be known

    Here is an example:

    Display Name: "Sai Krishna"

    lblLastNameFirstName.Text = "Sai Krishna"

    Query: 

    Set(varData,First(Office365Users.SearchUser({searchTerm:lblLastNameFirstName.Text})).Mail)

     

    FYI: Search Term applicable to  display name, given name, surname, mail, mail nickname, and user principal name. as per Microsoft Documentation 

  • rsaikrishna Profile Picture
    3,703 on at

    As @krishnags mentioned, you can use the formula to search the value. 

     

    Search term accepts following strings to search:

    display name, given name, surname, mail, mail nickname and user principal name. If not provided then no filtering will be applied.

     

    If the Search method returns multiple times, your desired value can be at any position. So filtering with proper value is important. Also, you must handle the case if Search does not return any values.

     

    Regards

    Krishna Rachakonda

    If this reply helped you to solve the issue, please mark the post as Accepted Solution. Marking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.

     

  • ahhollan Profile Picture
    576 on at

    so would it be simpler to change my first box to a people picker that is auto-assigned? if so, how do i do that?

  • rsaikrishna Profile Picture
    3,703 on at

    @ahhollan 

     

    On App Start : Set(varUser, Office365Users.MyProfile())

     

    On Textbox control card:

      default value:  varUser.Mail

      Update value: varUser.Mail

     

    But, you mentioned in your previous reply that you want to get the name from SharePoint list based on region and other information. The user who launches the app and who referred from your list, do you see both the values same? If not, then you must user approaches from @krishnags and mine to address the requirement.

     

    Regards

    Krishna Rachakonda

    If this reply helped you to solve the issue, please mark the post as Accepted Solution. Marking this post as Accepted Solution, will help many other users to use this post to solve same or similar issue without re-posting the issue in the group. Saves a lot of time for everyone.
  • ahhollan Profile Picture
    576 on at

    the form user and the person auto assigned to the first field are not the same. Where do i put the variable and the search formula? Sorry, I'm not good with formulas.

     

    thanks for the help.

     

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 330

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard