cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Retrieve person attributes from Sharepoint list field

I have a form that is linked to a Sharepoint list. One of the columns in the Sharepoint list is called Requestor and it used to store a person from the directory.


The form has a combobox linked to the Requestor field in the Sharepoint list. The combobox has DisplayFields ["DisplayName","Email","Picture"] and SearchFields ["DisplayName"]

 

I am able to use the combobox to select a person.

 

I want a button to add information about the Requestor to a collection. I want the DisplayName, Email and the ID of the person as separate fields in the collection. I am having difficulty working out how to access these attributes from the the person selected in the combobox. I think I have to use Office365Users to access these attributes but all my attempts to retrieve the person based on what is in the combobox have failed.

 

I think I just need an example of how to retrieve the displayname and email address for the user John Brown assuming this person is selected as the Requestor on  my form and to have one label set to the displayname and a second label set to the email address.

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

@dmorland 

Assuming your ComboBox is populated with Person objects you should be able to access their details.  To test try putting each of these code lines in a separate label within the Text property.

 

ComboBox.Selected.ID
ComboBox.Selected.DisplayName ComboBox.Selected.Email

 

You can PATCH the information into your datasource using the code below.  Please note, DataCardValue_ID.Text refers to a datacard for the record ID.  You must add it to your form but it can be invisible.

 

Patch(
    your_datasource_name,
    LookUp(your_datasource_name, ID=DataCardValue_ID.Text
    {
        EmployeeID: ComboBox.Selected.ID,
        DisplayName: ComboBox.Selected.DisplayName,
        Email: ComboBox.Selected.Email
    }
)

 

Let me know if this helps!

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

@dmorland 

Assuming your ComboBox is populated with Person objects you should be able to access their details.  To test try putting each of these code lines in a separate label within the Text property.

 

ComboBox.Selected.ID
ComboBox.Selected.DisplayName ComboBox.Selected.Email

 

You can PATCH the information into your datasource using the code below.  Please note, DataCardValue_ID.Text refers to a datacard for the record ID.  You must add it to your form but it can be invisible.

 

Patch(
    your_datasource_name,
    LookUp(your_datasource_name, ID=DataCardValue_ID.Text
    {
        EmployeeID: ComboBox.Selected.ID,
        DisplayName: ComboBox.Selected.DisplayName,
        Email: ComboBox.Selected.Email
    }
)

 

Let me know if this helps!

 

---
Please click "Accept as Solution" if my response helped to solve your issue so that others may find it more quickly. If your thought the post was helpful please give it a "Thumbs Up."

View solution in original post

Highlighted

Hi, thx for your help.  This worked ok for retrieving the DisplayName and Email but not the ID.  I was able to get the ID using:

 

First(Office365Users.SearchUser({searchTerm: DataCardValue2.Selected.DisplayName, top:1})).Id

Highlighted

@dmorland 

Excellent.  I am glad you were able to find the solution.  Please close this thread so others know the problem was solved. Cat Happy

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

News & Announcements

Community Blog

Stay up tp date on the latest blogs and activities in the community News & Announcements.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Community Highlights

Community Highlights

Check out the Power Platform Community Highlights

Top Solution Authors
Top Kudoed Authors
Users online (12,748)