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 / Patch sharepoint list ...
Power Apps
Answered

Patch sharepoint list from gallery

(0) ShareShare
ReportReport
Posted on by 726

I have a gallery that the managers can update the record for each item buy clicking save on each line, Is there a way they can save all updated in gallery to the sharepoint list instead of having to save each line 

 

At the moment, they select a save icon for each line to update the HourlyRate field in my sharepoint list CustomerCareRecord 

 

Patch(CustomerCareRecord, CCRD.Selected, {HourlyRate:TextInput17.Text})

 

Categories:
I have the same question (0)
  • Verified answer
    Ethan_009 Profile Picture
    4,838 Moderator on at

    Hi @amyharkus86 ,

     

    Create a collection of records that are updated in the gallery.

    Note: Your record must have a unique identifier to patch the datasource

     

    Let's say you have 5 fields in your gallery with editable control,

    OnChange of those controls, write the code as, 

    If(
     ThisItem.IsSelected,
     If(
     ThisItem.ID in ColCustomerCare.ID,
     Update(
     ColCustomerCare,
     LookUp(
     ColCustomerCare,
     ID = ThisItem.ID
     ),
     {
     //All fields that can be modified
     }
     ),
     Collect(
     ColCustomerCare,
     {
     //All fields that can be modified
     }
     )
     ),
     Clear(ColCustomerCare)
    );
    

     

    When you click on Save All, patch the collection,

    IfError(
     ForAll(
     ColCustomerCare,
     Patch(
     CustomerCareList,
     LookUp(
     CustomerCareList,
     ID = ColCustomerCare[@ID]
     ),
     {
     //All fields that needs to be updated
     }
     )
    ),
    Notify("Error in Saving Data",NotificationType.Error, 2000);
    false;
    ,
    Notify("Data Saved Successfully", NotificationType.Success, 1000);
    Clear(ColCustomerCare);
    true;
    );
    
    
    //OR entire collection
    IfError(
     Patch(
     <dataSource - ListSP>,
     ColCustomerCare
     )
    ),
    Notify("Error in Saving Data",NotificationType.Error, 2000);
    false;
    ,
    Notify("Data Saved Successfully", NotificationType.Success, 1000);
    Clear(ColCustomerCare);
    true;
    );

     

    Hope this helps

  • amyharkus86 Profile Picture
    726 on at

    @Ethan_R i get a red line under this part of the code

     

     ThisItem.ID in ColCustomerCare.ID,
  • Ethan_009 Profile Picture
    4,838 Moderator on at

    @amyharkus86 ,

     

    For you collection, 

    You need to include primary key also (this will determine, which record to patch),

     

    So, 

    {
     ID: <primary key>,
     // All other fields
    }

     

    Add the unique ID everywhere

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 329 Most Valuable Professional

#2
11manish Profile Picture

11manish 209 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 179

Last 30 days Overall leaderboard