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 from collection

(1) ShareShare
ReportReport
Posted on by 603

Hi all,

 

I'm building an app where I'm first collect a couple of SharePoint list items into a local collection, called "Col_TOBEAPPROVED".

 

The users can edit this collection inside my app.

 

When the are done with editing the multiple items, the "Col_TOBEAPPROVED" collection should be patched in to the original SharePoint list ("workregistration").

 

I was trying to do this with the follow statement, but it is not working:

 

ForAll(
 Col_TOBEAPPROVED,
 Patch(
 workregistration,
 LookUp(
 workregistration,
 Id = Col_TOBEAPPROVED.ID
 ),
 {
 Approved:Col_TOBEAPPROVED.Approved
 }
 )
 )

 

If someone of you have a clear solution or idea, I'm open for any suggestion.

 

Thanks in advance.

Categories:
I have the same question (0)
  • Verified answer
    RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @dennisb88 

    If your collection has the same column names (real names) as your datasource, then you need not do all of this, you can simply use the following:

    Patch(workregistration, Col_TOBEAPPROVED)

     

    If you need selective column changes instead of the full collection values, then the following:

    Patch(workregistration,
     ForAll(Col_TOBEAPPROVED As _item,
     {
     ID: _item.ID
     Approved: _item.Approved
     }
     )
    )

     

    ForAll is a function that produces a Table...use it in your Patch and Collect.  The Patch and Collect function can handle a full table as its argument and will speed of the performance rather than trying to use ForAll as a For/Loop.

     

    I hope this is helpful for you.

  • dennisb88 Profile Picture
    603 on at

    Thanks @RandyHayes , that's works as expected!

  • PDRinoG Profile Picture
    40 on at

    @RandyHayes 

    What is the easiest way to update the collection after saving the items to SharePoint via the method you described? Patch(workregistration, Col_TOBEAPPROVED)

     

    This will update all existing items in SharePoint and save newly created items. I would like to update the ID column in the collection for the new items, is this possible or do we need to use a forall function instead?
     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    You didn't state what control this expression should be on. Is it the OnSelect property of a button or where?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    I have the same scenerio, i created a save button and applied the expression on the OnSelect property of my button and it is not updating my list.

    OnSelect = Patch( RCalRebateRate, rateCameroon)

    I created a collection on the OnChange property of my Dropdown control. I want to be able to save changes made on the Gallery, spooling that collection to my SharePoint list. Below is expression used to create my

    ClearCollect(
     rateCameroon,
     Filter(
     RCalRebateRate,
     Market = "Cameroon",
     Band = Dropdown2.Selected.Value
     )
    )

    collection

  • StraighterSwing Profile Picture
    17 on at

    Did you ever figure this out?  I'm trying to do the same thing you are to "UPDATE" a record by looping through a collection instead of creating a new one.  

  • StraighterSwing Profile Picture
    17 on at

    Never mind.  I figured this out just now.  

    ForAll(CollectionName, Patch('SharePointList', First(Filter('SharePointList', ID = CollectionName[@ID])) , {Status_Txt:"Delivered"}))

  • LoghanRiodan Profile Picture
    16 on at

    Did you apply this to onselct of a button? What expression did you use?

  • LennartWalldén Profile Picture
    181 on at

    Hi @LoghanRiodan ,

    You can use the expression that @StraighterSwing posted above directly in the OnSelect property of a button. The only thing you need to change is your collection and list names and the actual column(s) to be patched.

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 Launch!

Jump in, show your community spirit, and win prizes!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the May Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Valantis Profile Picture

Valantis 421

#2
WarrenBelz Profile Picture

WarrenBelz 345 Most Valuable Professional

#3
Kalathiya Profile Picture

Kalathiya 278 Super User 2026 Season 1

Last 30 days Overall leaderboard