cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Microsoft
Microsoft

Update Multiselect Person or Group using Patch function to remove a user

I have a SharePoint List  named as  "News" with a Multiselect Person or group Column  named as "SPOCs".SpList.jpg

I have a PowerApps which has a Gallery1 (only to Display the list )with Data source as News List . I also have a textBox linked to Title , a DropDown control for Selecting the choices and a  comboBox1 which is shearchable box with data souce as SPOCs column  from my List.SpList1.jpg

 

I want to update the SPOCs column with the selections made in the ComboBox1.  on click of Button 1. I am using the Patch  function to do so and it looks like this.

OnSelect  of Button 1 :

ClearCollect(

    SPOCsToAdd,

    ComboBox1.SelectedItems,

    Gallery1.Selected.SPOCs

);

Patch(News,Gallery1.Selected,{TryChoises:{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Id:1,Value:Dropdown1.Selected.Value}},{Title:TextInput1.Text},{'SPOCs':ForAll(

            SPOCsToAdd,

            {

                Claims: Claims,

                Department: "",

                DisplayName: DisplayName,

                Email: Email,

                JobTitle: "",

                Picture: ""

            }

        )

});

Refresh(News);

 

Issue :  My Patch Function work fine if i have a new user to be added to the SPOCs field, however if have to remove someone from the existing list it does not removes the user. For Example my First record has 2 SPOCs selected as  TestUser1 and TestUser2  and now I want to remove TestUser1 and add a new SPOC as TestUser3. My patch Function is currently giving me a result update as all the three users in the SPOC column instead of 2 Users 

 

 

 

 

 

2 REPLIES 2
Community Support
Community Support

Hi @GouravChawla,

Can you share a bit more about your issue ?

Can you show me the formula of ComboBox1 ?

 

You can add a new combo box and set it to display the initial selections from the selected item in the gallery.

The new comboBox will have two SPOCs selections : TestUser1 and TestUser2 ,You can only select “TestUser2within new combo box.

 

I made a test . It worked.

 

I added a combo box named “ComboBox2.

Set the items property of ComboBox2 to:

Gallery1.Selected.SPOCs

17.PNG18.PNG19.PNG

 

Set Onselect property of the button to :

ClearCollect(collection3,ComboBox1.SelectedItems,ComboBox2.SelectedItems);Patch(News,Gallery1.Selected,{Title:TextInput1.Text},{TryChoises:{Id:1,Value:Dropdown1.Selected.Value}},{'SPOCs':ForAll(collection3,{'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",Claims:Claims,Department: "",DisplayName: DisplayName, Email: Email, JobTitle: "",Picture: ""})})

 

Regards,

Eason

 

Community Support Team _ Eason YU
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

Hi 

 

My Combox Formula looks like this 

ComboBox1.jpg

Thanks for creating a prototype App for the concerned issue and the solution works well for my case too. However, the app which I shared in this question is my Demo Sample app , the production App created for the customer has almost 10 combo boxes for 10 Person or group fields. So as per your soultion I might land up adding additional 10 conrtorls to get the required out come which looks cumbersome. Since comboBox is an out of the box controls it should have the capabiltiy for removing the users while patch or update. Do we have any other work around for this or we need to post an Idea request to the engineering team  ?

 

Helpful resources

Announcements
News & Announcements

Community Blog

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

Power Apps Community Call

Power Apps Community Call- January

Mark your calendars and join us for the next Power Apps Community Call on January 20th, 8a PST

PP Bootcamp Carousel

Global Power Platform Bootcamp

Dive into the Power Platform stack with hands-on sessions and labs, virtually delivered to you by experts and community leaders.

secondImage

Power Platform Community Conference On Demand

Watch Nick Doelman's session from the 2020 Power Platform Community Conference on demand!

Top Solution Authors
Top Kudoed Authors
Users online (5,146)