Skip to main content

Notifications

Power Apps - Building Power Apps
Answered

Patch multiselect combobox into SharePoint multi person field by retaining existing values.

(0) ShareShare
ReportReport
Posted on by 75
ForAll(
    colUpdate_SharedCollections,
    Patch(
        GS_Shared_Greenhouse,
        LookUp(
            GS_Shared_Greenhouse, ID = colUpdate_SharedCollections[@ID]
        ),
        {
            SharedUsers: cbxUsers_SharedCollections.SelectedItems
        }
    )
)
Hi everyone,
 
The code patches the values from the combobox into SharedUsers(Multi person field in SharePoint). However, it is removing the existing values in "SharedUsers" when I patch it. I would like to retain the existing values, how do I do that?
 
Thanks
  • Verified answer
    narayan225 Profile Picture
    narayan225 2,390 on at
    Patch multiselect combobox into SharePoint multi person field by retaining existing values.
    Generally when using combo-box, you render the combo-box with the list of items that are already selected and when you select more items, it patches the existing ones and the new one seamlessly.
     
    Because you want to patch the multi-choice field with both the existing selection as well as the new ones, you will need to first store the existing items in a collection.
    Then, use the selected items property to add new items into that collection and later patch the collection to the multi-choice column in SharePoint.
     
    ClearCollect(existingchoiceslist,LookUp(DataSource,LookUpCondition.Column); //this will store the column data to the existinchoiceslist collection.
    ForAll(existingchoicelist, Collect(choicelist, ThisRecord)); //This is to look out for duplicates
    Collect(choicelist, comboBox.SelectedItems); //This will then create a final collection with both existing value and selected values
    After this you can try and patch the column using the above formula that you provided.
     
    hope this works.

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,434

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,722

Leaderboard