web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Issue with saving Mult...
Power Apps
Unanswered

Issue with saving Multi Select Combobox (LookUp column in SharePoint) back to SharePoint

(0) ShareShare
ReportReport
Posted on by 181

Hi all,

This is my scenario:

  • I have one SPO list with over 10,000 records and a (Child) document library with a lookup column to the Parent list.
  • I customized the child library with PowerApps simply because the lookup column won't work with more than 5000 records.
  • I removed the lookup column in PowerApps and added the ComboBox. I used the below code on the Items attributes to get the data from the Parent list into my Combobox.
  •  

 

 

If(IsBlank(ComboBox2.SearchText), Filter('FileService_neats.Alf', StartsWith(FileName, "1")),Filter('FileService_neats.Alf', StartsWith(FileName, ComboBox2.SearchText))) 

 

 

  • On the ComboBox OnSelect attributes I created a collection to store data.

 

 

ClearCollect(LookUpFieldResponse, { Id: ComboBox2.Selected.ID, Value :ComboBox2.Selected.Title}) 

 

 

  • And under Update attributes I have used below code to save the single records:

 

 

{
'@odata.type':"#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
Id: ComboBox2.Selected.ID,
Value: ComboBox2.Selected.Title
} 

 

 

  • I have changed the Allowed the SelectMultiple for the ComboBox in PowerApps
  • The Allow multiple values in SharePoint is turned off, if I turn it on I get below error message.
  • Capture2.PNG
  • I tried below codes to allow me to save multiple selection, but it didn't work.

 

 

ForAll(
 ComboBox2.SelectedItems,
Patch(
 'Harris Document Testing 5000 records',
 Defaults('Harris Document Testing 5000 records'),
 {
 Title:ComboBox2.Selected.Title,
 Lookup:{
 '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
 Id: ComboBox2.Selected.ID,
 Value: ComboBox2.Selected.Name
 }
 }
)
) 

 

 

  • Capture5.PNG
Categories:
  • WarrenBelz Profile Picture
    156,967 Most Valuable Professional on at

    Hi @Harris021 ,

    Try this

    Patch(
     'Harris Document Testing 5000 records',
     Defaults('Harris Document Testing 5000 records'),
     {
     Title: ComboBox2.Selected.Title,
     Lookup:
     ForAll(
     ComboBox2.SelectedItems,
     {
     
     Id: ID,
     Value: Name
     }
     }
     )
    ) 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • Harris021 Profile Picture
    181 on at

    @WarrenBelz Thanks for your message.

    I am getting the below error message:

     

    Capture12.PNG

  • M_Ali_SZ365 Profile Picture
    1,110 on at

    Hi @Harris021,

    Try This Code,

    ForAll(
     ComboBox2.SelectedItems,
     Patch(
     'Harris Document Testing 5000 records',
     Defaults('Harris Document Testing 5000 records'),
     {
     Title: ComboBox2.Selected.Title,
     Lookup:{
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Id: ComboBox2.Selected.ID,
     Value: ComboBox2.Selected.Title
     }
     }
     )
    )

    If this solution resolves your issue, please consider marking it as accepted. ✅

    Warm regards,
    Muhammad Ali

  • Harris021 Profile Picture
    181 on at

    @M_Ali_SZ365 Hi Ali, unfortunately still getting the error message.

    Capture20.PNG

  • M_Ali_SZ365 Profile Picture
    1,110 on at

    Hi @Harris021 ,

    Try This Code,

     

    // When a user clicks the submit button after selecting items in the ComboBox
    OnSelect:
     // First, clear any existing items in the collection
     Clear(colSelectedItems);
     
     // Then collect the current selected items
     ForAll(
     ComboBox2.SelectedItems,
     Collect(
     colSelectedItems,
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Id: Value.Id,
     Value: Value.Title
     }
     )
     );
     
     // Now patch the collection to SharePoint
     Patch(
     'Harris Document Testing 5000 records',
     Defaults('Harris Document Testing 5000 records'),
     {
     Title: TextInput1.Text, // Assuming you have a TextInput control for the Title
     Lookup: colSelectedItems
     }
     );
     
     // Clear the collection for next use
     Clear(colSelectedItems);

     

    Unlocking solutions together! 🌟 If I've been of help, click 'Solution Accepted.' Your action lights the way for others. Thank you!

    Warm regards,

    Muhammad Ali

  • Harris021 Profile Picture
    181 on at

    @M_Ali_SZ365 didnt work

    Capture21.PNGCapture22.PNG

  • Harris021 Profile Picture
    181 on at

    @M_Ali_SZ365 I wont get error onSelect if I do it this way:

    Capture23.PNG

  • WarrenBelz Profile Picture
    156,967 Most Valuable Professional on at

    Hi @Harris021 ,

    There are two possibilities here depending on the Items of ComboBox2. If it is Choices(YourListName,YourLookupFieldName), you can simply do this

    Patch(
     'Harris Document Testing 5000 records',
     Defaults('Harris Document Testing 5000 records'),
     {
     Title: ComboBox2.Selected.Title,
     Lookup: ComboBox2.SelectedItems
     }
    ) 

    If however you have changed the Items and they are now outputting a field name, this gets complex as you have to "get the ID back" - something like this

    Patch(
     'Harris Document Testing 5000 records',
     Defaults('Harris Document Testing 5000 records'),
     {
     Title: ComboBox2.Selected.Title,
     Lookup:
     ForAll(
     ComboBox2.SelectedItems As _Sel,
     {
     Value: _Sel.FieldName,
     Id: 
     LookUp(
     YourOtherList,
     YourLookedUpFieldName = _Sel.FieldName
     ).ID
     }
     )
     }
    ) 

     

    Please click Accept as solution if my post helped you solve your issue. This will help others find it more readily. It also closes the item. If the content was useful in other ways, please consider giving it Thumbs Up.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • M_Ali_SZ365 Profile Picture
    1,110 on at

    @Harris021 ,

    Clear(colSelectedItems);
    
    ForAll(
     ComboBox2.SelectedItems,
     Collect(
     colSelectedItems,
     {
     '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedReference",
     Id: ThisItem.ID, // Replace 'ID' with the actual field name for the ID in your ComboBox items
     Value: ThisItem.Title // Replace 'Title' with the actual field name for the Title in your ComboBox items
     }
     )
    );

    If this solution resolves your issue, please consider marking it as accepted. ✅

    Warm regards,
    Muhammad Ali

  • Harris021 Profile Picture
    181 on at

    Hi @M_Ali_SZ365 

    Do I need to create a save button? what happen if I just want to use SharePoint library default save option?

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 220 Super User 2026 Season 2

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard