Hi Guys,
I've had a good trawl through similar questions but just can't seem to get this to work...
I would like to be able to pick a user from the Office365Users list and store the user details in a SharePoint List.
I have created a SharePoint List (Test People) with two columns:
I can add records to this in SP and it happily lets me pick Users and add them.
I've gone on to create a Power App based on this list. I'm using the 'Start from data' method connecting to this List. When built, I add the Data Source; Office365Users.
The app consist of 3 screens, but the one I am interested in here is the EditScreen. To configure this:
Now, I know that this will not bring back a full list for a large number of user but our user base is quite small and, anyway, one thing at a time...
When I test this app:
I've tried a few of the suggestions on this forum but don't seem to be able to get any of them to work. Can anyone point me in the right direction?
Cheers
Steve
Solved! Go to Solution.
Hi @SteveRoach ,
Do you want to populate the Person field ComboBox with users retrieved from the Office365Users.SearchUser() function?
Based on the issue that you mentioned, I think this issue is related to that you do not bind the selected user (retrieved from the Office365Users.SearchUser() function) in your Person field ComboBox to the Person field in your Edit form properly.
I have made a test on my side, please take a try with the following workaround:
Set the Update property of the Person field data card in the Edit form to following:
{
Claims: "i:0#.f|membership|" & Lower(DataCardValue11.Selected.Mail),
DisplayName: DataCardValue11.Selected.DisplayName,
Email: DataCardValue11.Selected.Mail,
Department: "",
JobTitle: "",
Picture: ""
}
Note: The DataCardValue11 represents the ComboBox inside my Person field data card.
On your side, you may try the following formula within the Update property of the Person field data card:
{
Claims: "i:0#.f|membership|" & Lower(PersonFieldComboBox.Selected.Mail),
DisplayName: PersonFieldComboBox.Selected.DisplayName,
Email: PersonFieldComboBox.Selected.Mail,
Department: "",
JobTitle: "",
Picture: ""
}
Please try above solution, then check if the issue is solved.
Regards,
see patching person field in this post https://www.about365.nl/2018/11/01/handling-sharepoint-lookup-and-people-fields-in-powerapps/
you need to specify all of those parameters otherwise it will not populate correctly. This is kind of frustrating because in flow you just need the email address
Hi @SteveRoach ,
Do you want to populate the Person field ComboBox with users retrieved from the Office365Users.SearchUser() function?
Based on the issue that you mentioned, I think this issue is related to that you do not bind the selected user (retrieved from the Office365Users.SearchUser() function) in your Person field ComboBox to the Person field in your Edit form properly.
I have made a test on my side, please take a try with the following workaround:
Set the Update property of the Person field data card in the Edit form to following:
{
Claims: "i:0#.f|membership|" & Lower(DataCardValue11.Selected.Mail),
DisplayName: DataCardValue11.Selected.DisplayName,
Email: DataCardValue11.Selected.Mail,
Department: "",
JobTitle: "",
Picture: ""
}
Note: The DataCardValue11 represents the ComboBox inside my Person field data card.
On your side, you may try the following formula within the Update property of the Person field data card:
{
Claims: "i:0#.f|membership|" & Lower(PersonFieldComboBox.Selected.Mail),
DisplayName: PersonFieldComboBox.Selected.DisplayName,
Email: PersonFieldComboBox.Selected.Mail,
Department: "",
JobTitle: "",
Picture: ""
}
Please try above solution, then check if the issue is solved.
Regards,
Hi jlindstrom,
I'm sorry, this doesn't seem to align with what I'm trying to do.
I have an EditForm screen with a data card: Person_DataCard2. Under this is a DataCardValue4.
I have put the following into the data card value/Items property: Office365Users.SearchUser({searchTerm : "", top:999})
This allows me to correctly pick a 365 user.
I don't really understand how this patching is supposed to work. It looks like I put the patch instruction into the data card Update property (is that right?). But the example given is nothing like either my App or List (I appreciate they may have different names but the structures don't look similar). What does "All of these properties can be pulled from the control itself:" mean?
I've tried this but it's throwing an error ('Test People' is my list, Person is a column in the list):
And the error:
TIA
Steve
Hi Kris Dai, I'm afraid I'm out of time to work on this this week. I'll get back to it on Monday and let you know how it went.
Cheers
Steve
Hi @SteveRoach ,
Sure. Regarding the needs that you mentioned, I think the solution I provided could achieve your needs. It's easy enough.
Please take a try with the solution I provided, if the issue is solved, please go ahead to click "Accept as Solution" to identify this thread has been solved.
Regards,
Hi Kris,
That worked very well. Thanks you for your help with this.
Cheers
Steve
Worked well for me too!!! Thank you
I was able to use the solution presented successfully when only 1 person is selected. How can I make this work when the Person Group Combo Box allows multiple selections?
Working Solution for 1 Person Selected
{
Claims: "i:0#.f|membership|" & Lower(DataCardValue11.Selected.Mail),
DisplayName: DataCardValue11.Selected.DisplayName,
Email: DataCardValue11.Selected.Mail,
Department: "",
JobTitle: "",
Picture: ""
}
ATTEMPT for Multiple Selections
I tried to change Selected. to SelectedItems. in the above code but that returned an error message. Can please anyone help solve this?
Thank you!
Hi @Anonymous
This is how I have done it
// Add all selected approvers to the collection "CollSelectedApprovers"
// The Combobox has the following fields Primary text: DisplayName, Secondary text:Email, SearchField: DisplayName
ForAll(
DataCardValueApprovers.SelectedItems,
Collect(
CollSelectedApprovers,
{
Email: Email,
Claims: "i:0#.f|membership|" & Lower(Email),
Department: "",
JobTitle: "",
Picture:"",
DisplayName:DisplayName
}
)
);
// Loop through all the selected approvers to create the JSON that you need
//to patch multiple people. Add the JSON to the collection “CollectedApprovers_Table”
ForAll(
CollSelectedApprovers,
Collect(
CollSelectedApprovers_Table,
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Email: Email,
Claims: "i:0#.f|membership|" & Lower(Email),
Department: "",
JobTitle: "",
Picture:"",
DisplayName:DisplayName
}
)
);
//Insert the new record into the ‘Docs Approvals’ table using the patch function, for the Approvers
// field use the collection ‘CollSelectedApprovers_Table,’ created above
Patch('Docs Approvals', Defaults('Docs Approvals'),
{
Title: DataCardValue1.Text,
Initiator: {'@odata.type':
"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & DataCardValueInitiator.Selected.Email,
Department: "",
DisplayName: DataCardValueInitiator.Selected.DisplayName,
Email: DataCardValueInitiator.Selected.Email,
JobTitle: "",
Picture: ""
},
Approvers: CollSelectedApprovers_Table,
Document: DataCardValueDocument.Selected
}
);
Let me know if you have any questions
User | Count |
---|---|
258 | |
108 | |
93 | |
57 | |
41 |