cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
New Member

Patch People field that allows multiple values

I am trying to Patch a SharePoint People field that allows multiple values. I have been able to patch a SharePoint People column as long as it contains one value...but if the People column allows multiple values, my patch statement only gets the first value and does not work properly. I don't want to use a form and would really prefer Patch, but I'm stuck on this. My People values are coming from a combo-box in which the user inputs multiple people...anywhere from 1 to 6 people...so the Patch statement can't be hardcoded and must be able to read the input from the user via the combo box. 

25 REPLIES 25
Highlighted

@bregan507 

This is not hard once you get used to what is going on.  

 

Please make sure that you have the Search turned on and the Multi select turned on for the combobox.  You will have the search capability based on the formula I gave you for Items.

 

But...let's recap:

1) What is your Items property on the ComboBox?

2) What is the DefaultSelecteItems of the combobox (if different than mentioned before)?

3) What is your update/patch formula?

4) Is the search and multi-item property turned on for the combobox?

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!
Highlighted


Patch(
CQ_Data,
varRecord,
{
Reviewer: ForAll(
Filter(
Split(
Concat(
cboReviewer.SelectedItems,
Email & ";"
) & Concat(
varRecord.Reviewer,
Email & ";"
),
";"
),
!IsBlank(Result)
),
{
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: Result,
Department: "",
DisplayName: Result,
Email: Result,
JobTitle: ".",
Picture: "."
}
),
Approver: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: cboApprover.Selected.Mail,
Department: "",
DisplayName: cboApprover.Selected.DisplayName,
Email: cboApprover.Selected.Mail,
JobTitle: "",
Picture: ""
},
Title: txtTitle.Text,
Description: txtDescription.Text,
YN_SendReview: varSendReview,
RequestType: {Value: ddlRequestType.Selected.Value},
Department: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Value: cboDept.Selected.Title,
Id: cboDept.Selected.ID
},
Tier: ddlTier.Selected.Value,
Priority: ddlPriority.Selected.Value,
TicketStatus: ddlTicketStatus.Selected.Value,
Contact: {
'@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
Claims: cboContact.Selected.Mail,
Department: "",
DisplayName: cboContact.Selected.DisplayName,
Email: cboContact.Selected.Mail,
JobTitle: "",
Picture: ""
}
}
);

Refresh(CQ_Data);
Navigate(Success)

Highlighted

cboReviewers combobox

Items: Choices(CQ_Data.Reviewer)
DefaultSelectedItem: varRecord.Reviewer
I had multiple already turned on but did not have search turned on. I turned it on and that allowed search to work (I told you I was new)  😊

Highlighted

@bregan5072 

So, some progress then 🙂

 

Couple things:

1) Your Items property should be :  Choices([@CQ_Data].Reviewer) not using the [@ ] around the datasource name sometimes causes issues with the choice selections (I think it was once a bug, maybe resolved now, but doesn't hurt).

 

2) Here is what we should get to with your Patch formula:

Patch(
   CQ_Data,
   varRecord,
   {
      Reviewer: cboReviewer.SelectedItems,
      Approver: cboApprover.Selected,
      Title: txtTitle.Text,
      Description: txtDescription.Text,
      YN_SendReview: varSendReview,
      RequestType: {Value: ddlRequestType.Selected.Value},
      Department: {
         '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
         Value: cboDept.Selected.Title,
         Id: cboDept.Selected.ID
         },
      Tier: ddlTier.Selected.Value,
      Priority: ddlPriority.Selected.Value,
      TicketStatus: ddlTicketStatus.Selected.Value,
      Contact: cboContact.Selected
   }
);

//Refresh(CQ_Data);
Navigate(Success)

To get to that, we need to adjust the cboApprover Items and a defaultselectedItems property (I assume from your formula that it is a single person column).  Follow the same process that we just used on the Reviewer (cboReviewer) esxcept adjust for Approver.

Likewise for Contact and the cboContact control.

 

The Department can be simplified as well, but I left it as was in the original for the moment.

I'm not sure what you've got going on with RequestType...is that a Choice Column?  If so, it needs some adjustment.

Also, no need to Refresh the datasource...PowerApps will have already updated it with the Patch statement.  No need for the extra performance hit to refresh.

 

I think you made some progress on the Reviewer that you can carry on to the above mentioned items.  Give that a college try and see where you get.  I am about to step away from the computer for the majority of the night and become less responsive to messages, but I will try and pop back and forth if you struggle.  Otherwise I will respond more tomorrow.

 

 

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

View solution in original post

Highlighted

Oh my goodness...success! I am very thankful to you. You are kind and patient and are to be commended. I'm surprised that you stuck around this long to help me. I'm very grateful - this has taken me several days to resolve. I've gotten better as a PowerApps developer today and I appreciate your time.  I am going to implement your suggestions on my other fields. I've removed the Refresh and I've already noticed a performance improvement.  Thank you again for your help.  Any other suggestions tomorrow? 😀 I'll implement them too. 

Highlighted

@bregan5072 

Thank you for your kind words.  I am more than happy to help and will always try to stick with the problem until resolved (although I tend to lose some threads trying to keep track on this forum)

 

I am glad you had a moment of success and learned some along the way.  Everyday is another day to learn some more.  Feel free to post out any issues you run into.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.
Check out my PowerApps Videos too!

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 (7,197)