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 / Update SharePoint List...
Power Apps
Answered

Update SharePoint List (by record) with Gallery.Selected

(0) ShareShare
ReportReport
Posted on by 12

myGallery item = col_SelectedRecord (a filtered by ID from spAllRecords table)

 

After I'm updating the fields in myGallery, can I write the whole thing as a single record back to spAllRecords table?

 

I have tried, but failed

Patch(spAllRecords , First(Filter(spAllRecords , ID = ThisItem.ID)),  ThisItem);

 

Thank you for your help!

 

 

Categories:
  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @NathanWynn 

    What you will want is more like this:

    UpdateIf(yourList, ID=ThisItem.ID, {column1: <control.text|selected|etc Or ColumnName>})

     

    I hope this is helpful for you.

  • NathanWynn Profile Picture
    12 on at

    I'm hoping to write as a single record and not have to list out all the fields.

    Patch(spAllRecords , col_SelectedRecord); was ok until {versionnumber} is read only error.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @NathanWynn 

    Can you explain your scenario more?

    My understanding was that you have a gallery with controls in it and you are wanting to write the value of those controls to the datasource and to the underlying record.

     

    Also explain the collection and what that is for.  Since there is no need for a collection for any of this, it would be beneficial to know its purpose in your scenario.

     

    Or...are you trying to write all of the records of the Gallery to the datasource?

  • NathanWynn Profile Picture
    12 on at

    I apologize for the lack of info upfront.

    When I select a record, I put the selected record into a varSelectedRecord and set the gallery1 item to varSelectedRecord.

     

    In gallery1, with just that 1 item, I have quite a few fields that I allow users to update. Once updated, upon Save, I would like to write back to the table everything in gallery1 with the need to specify colum1: textbox1.text etc.

    Patch(spList, Filter(spList, ID = varSelectedRecord.ID, varSelectedRecord)

     

    Ultimately, I'm looking for the SubmitForm(form1) for the gallery.

  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @NathanWynn 

    So perhaps your last statement is more relevant!  Why not just use a Form?  Having a gallery to display one Item is not really what a gallery was designed for, however, a Form is exactly what it is designed for.

     

    This would reduce your work completely.  

     

    Is there any reason to not use a form?

  • NathanWynn Profile Picture
    12 on at

    Hmm, that's a good question. Maybe I should reconsider. I'm still curious though, if there is such way.

    Thank you for your time @RandyHayes 

  • NathanWynn Profile Picture
    12 on at

    For those who are curious, the solution is very simple. I had a little error in my test case; therefore, it didn't work as expected.

    Here is the code that sends the entire selected record from a gallery to SharePoint List.

    Patch(spTable, gallery.Selected);

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 360 Super User 2026 Season 2

#2
M Bilal Khan Profile Picture

M Bilal Khan 325

#3
Mohsin Ali Profile Picture

Mohsin Ali 232

Last 30 days Overall leaderboard