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 / Updating two Sharepoin...
Power Apps
Answered

Updating two Sharepoint lists (connected via Lookup column) from a Collection

(0) ShareShare
ReportReport
Posted on by 29

Hi all,

We have a Loan System that allows us to loan laptops out to students and keep track of who has which device. This runs off of multiple SharePoint lists - LoansLoan Assets and Users

Loans makes use of multiple lookup columns to both Loan Assets and Users to get information about who loaned a device and which device they loaned.

 

We have it all working so that we can enter loans via a form, view them through a Gallery, and return them via another form.

  • When a loan is returned, the ReturnDate is set to Now() in Loansand the Availability of an asset is set to 0 in Loan Assets.
  • This prevents us from loaning out the same device multiple times. 

We're finding that at the end of the day when we get ten loans back at once, it would be good to be able to return them all quickly. To go about this, I added a checkbox to the Gallery that adds the selected item to a collection - SelectedItems. There is a button that has the following OnSelect value:

 

 

ForAll(SelectedItems As myItem,
 Patch(Loans, 
 LookUp(Loans, ID = myItem.ID),
 {
 'Date Returned': Now()}
 )
 );
 Patch('Loan Assets', 
 LookUp('Loan Assets', Tag = LoanTagField.Selected.Value),
 {
 Available: 0}
 );
 
Clear(SelectedItems);

 

 

This works for returning one item, but it doesn't iterate over all items in the Collection.

How can I get this to work for all items in SelectedItems?

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    154,755 Most Valuable Professional on at

    HI @mjohnson17 ,

    Your first one should work like this (and much faster as well)

    Patch(
     Loans,
     ForAll(
     SelectedItems As myItem,
     {
     ID:myItem.ID,
     'Date Returned': Now()
     }
     )
    )

    The second one though does not have any reference to your collection, so it will simply patch the same record with the same value.

     

    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.

    Visit my blog Practical Power Apps

     

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 493 Most Valuable Professional

#2
11manish Profile Picture

11manish 479

#3
Haque Profile Picture

Haque 328

Last 30 days Overall leaderboard