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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / LookUp inside Patch in...
Power Apps
Suggested Answer

LookUp inside Patch inside ForAll only updating the first record

(1) ShareShare
ReportReport
Posted on by 4
I am trying to Patch 2,250+ records at once using the on select of a button with the formula below. The two variables to filter by Due Date are established when navigating to this page and work fine inside the gallery itself. Problem is when the button is clicked, it updates the first record being displayed in the gallery appropriately but then sits "loading" (with the 5 dots scrolling across the top of the page) and never updates another record. Is there a better way to handle this type of request back to the SharePoint list?
 
ForAll(
    Gallery1.AllItems,
    Patch(
        'Master Sanitation List',
        LookUp(
            'Master Sanitation List',
            ThisRecord.ID = ID
        ),
        {'Reviewed by FSQA': "Yes",
        'Reviewed by FSQA On': Today(),
        'FSQA Review Completed By': {
                '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
                Department: "",
                Claims: "i:0#.f|membership|" & varCurUser.Email,
                DisplayName: varCurUser.FullName,
                Email: varCurUser.Email,
                JobTitle: "",
                Picture: ""
            }
        }
    )
)
Categories:
I have the same question (0)
  • WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at
    Hi TYSCC,
     
    You need to refer to the record as below - also this format is far more efficient.
    Patch(
       'Master Sanitation List',
       ForAll(
          Gallery1.AllItems As _Data,
          {
             ID: _Data.ID,
             'Reviewed by FSQA': "Yes",
             'Reviewed by FSQA On': Today(),
             'FSQA Review Completed By': 
             {
                Department: "",
                Claims: "i:0#.f|membership|" & varCurUser.Email,
                DisplayName: varCurUser.FullName,
                Email: varCurUser.Email,
                JobTitle: "",
                Picture: ""
             }
          }
       )
    )
     
    Please click Does this answer your question 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 a Like.
    MVP (Business Applications)     Visit my blog Practical Power Apps    Buy me a coffee

     
  • BCLS776 Profile Picture
    8,994 Moderator on at
    Further to Warren's answer, a ForAll() using a gallery's AllItems property will frequently operate on only the first 100 records, and certainly no more than the row limit for the app. For as many records as you are updating, consider doing some sort of batch update or use Power Automate (it can handle 5000 rows at a time).
     
    Hope that helps,
    Bryan
  • MichaelFP Profile Picture
    1,847 Super User 2025 Season 2 on at
    Hi! you can use With() inside for all for better control of the context. Because forAll could have concurrence so using With it will help for that.
     
    The With function evaluates a formula for a single record. The formula can calculate a value and/or perform actions, such as modifying data or working with a connection. Use the ForAll function to evaluate a formula for all the records in a table of records.
     
     
    Here sample based on you formula.
    ForAll(
        Gallery1.AllItems,
        With(LookUp(
                'Master Sanitation List',
                ThisRecord.ID = ID
            ) as RecordToUpdate,
        Patch(
            'Master Sanitation List',
            RecordToUpdate,
            {'Reviewed by FSQA': "Yes",
            'Reviewed by FSQA On': Today(),
            'FSQA Review Completed By': {
                    '@odata.type': "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
                    Department: "",
                    Claims: "i:0#.f|membership|" & varCurUser.Email,
                    DisplayName: varCurUser.FullName,
                    Email: varCurUser.Email,
                    JobTitle: "",
                    Picture: ""
                }
            }
        )
      )
    )
     
  • Suggested answer
    TYSCC Profile Picture
    4 on at
    Thank you all for the suggestions, I have actually reached the desired result via creating/updating a collection then patching that collection back to the SP List. Appreciate the advice from you all!  

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 739 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard