I have a gallery with several fields, including one SharePoint multi-person field, which in PowerApps is a ComboBox that looks up the Microsoft users.
I cannot get the multi-person field to patch consistently. It was working, then it wasn't, so I changed the code in the Collect to MyComboBox.SelectedItems, as I saw in an article online. That worked, for a while, so I uncommented and deleted my previous code...
Now, it MyComboBox.SelectedItems has stopped working. It still writes to my collection fine, but when I go to patch it doesn't save to the SharePoint list, even though there is no error (I have a success/fail message and it says 'success').
I cannot work out the right syntax and/or remember my previous code. I know it was something with a ForAll and some variation of:
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & ThisRecord.Mail,
Department: "",
DisplayName: ThisRecord.DisplayName,
Email: ThisRecord.Mail,
JobTitle: "",
Picture: ""
}
Nothing I find online seems to be collecting from a ComboBox, but rather manually adding a table with specific people, which is not what I need.
Can someone help me please?
Solved! Go to Solution.
Hi @RABronn ,
I assume the Items of the Combo box as follows:
So DefaultSelectedItems of the same Combo box will be:
Filter(Office365Users.SearchUserV2().value, DisplayName in ThisItem.Assigned.DisplayName)
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
What is your entire formula? Your formula shows "ThisRecord" in it. That indicates that you are either in a Form with this formula or that you have additional formula surrounding this chunk of it.
That was just an example, but I've just worked out what I had before (finally), and updated my formula to that, which is working (formula below).
I've also worked out why it wasn't working... it's because the DefaultSelectedItems isn't working correctly (it puts the DisplayName in but isn't selecting the person. I just have it as ThisItem.Assigned currently, which obviously isn't correct. I guess I need to do a ForAll and LookUp for each person that is selected in the SharePoint list? How do I do that?
Currently it works for ComboBoxes that didn't have anything in previously, but not if I am adding items when something is already there (because my collection is pulling incomplete data for the existing people).
If(
ThisItem.ID in colProjectListStatusView.ID,
Update(
colProjectListStatusView,
LookUp(
colProjectListStatusView,
ID = ThisItem.ID
),
{
ID: ThisItem.ID,
Title: txtProject.Text,
StatusMain: cbStatusMain_1.Selected.Status,
StatusDetail: cbStatusDetail_1.Selected.ShortenedActiveList,
Assigned: ForAll(
valAssigned_1.SelectedItems,
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Lower(Mail),
Department: "",
DisplayName: DisplayName,
Email: Mail,
JobTitle: "",
Picture: ""
}
),
AssignedInitials: lblAssigned1.Text,
Priority2: cbPriority_1.Selected.Value
}
),
Collect(
colProjectListStatusView,
{
ID: ThisItem.ID,
Title: txtProject.Text,
StatusMain: cbStatusMain_1.Selected.Status,
StatusDetail: cbStatusDetail_1.Selected.ShortenedActiveList,
Assigned: ForAll(
valAssigned_1.SelectedItems,
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: "i:0#.f|membership|" & Lower(Mail),
Department: "",
DisplayName: DisplayName,
Email: Mail,
JobTitle: "",
Picture: ""
}
),
AssignedInitials: lblAssigned1.Text,
Priority2: cbPriority_1.Selected.Value
}
)
)
I managed to get the DefaultSelectedItems to work off a label that Concats the values from the Multi-Person column for now. It isn't the most elegant solution though, so if there is a better way, please let me know.
Hi @RABronn ,
I assume the Items of the Combo box as follows:
So DefaultSelectedItems of the same Combo box will be:
Filter(Office365Users.SearchUserV2().value, DisplayName in ThisItem.Assigned.DisplayName)
Best regards,
Community Support Team _ Jeffer Ni
If this post helps, then please consider Accept it as the solution to help the other members find it.
Hi @v-jefferni
That works, thank you. I tried various iterations, but forgot the simple solution! (I still get confused with the various ways of dealing with different PowerApps inputs and SharePoint columns.)
User | Count |
---|---|
257 | |
110 | |
90 | |
51 | |
44 |