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.
Solved! Go to Solution.
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."
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."
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
Excellent. I am glad you were able to find the solution. Please close this thread so others know the problem was solved.
User | Count |
---|---|
197 | |
105 | |
88 | |
45 | |
43 |
User | Count |
---|---|
245 | |
105 | |
103 | |
65 | |
60 |