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 / Patching really slow t...
Power Apps
Answered

Patching really slow to SharePointsList?

(0) ShareShare
ReportReport
Posted on by 997

Hello,

I was wondering if someone has a better solution for patching to SharePointsList

It takes really more then 5 minutes to update a simple line or lines
My code:

If(Connection.Connected;
IfError(
 
 ForAll(
 colPickUp1;
 Patch(
 OnlineData;ThisRecord;
 { 
 PickUp:1
 } 
 ))
 ;UpdateContext({varShowPopup22:false});;Set(ShowAccessError;true);;Set(varError;FirstError.Message)
 ;
 UpdateContext({varShowPopup22:false});;Reset(Gallery3_2);;UpdateContext({checkedout:Blank()});;Refresh(OnlineData);;Clear(colPickUp1);;UpdateContext({varall1:false});;
UpdateContext({varall:false});;
UpdateContext({IsReset:false});;
UpdateContext({IsReset:true})
 )

;
Set(varNoconnection;true)
)

Is there something wrong with the code? why it going that slow

Thank you

Categories:
  • Verified answer
    WarrenBelz Profile Picture
    156,736 Most Valuable Professional on at

    Hi @TimmyBoy ,

    I will offer some fundamental advice here that may assist with this and future ForAll() exercises. It is not designed to be a Loop, although it can work this way with considerable performance penalty as it does an individual Patch for each record. ForAll() creates a Table, which can be patched in one action provided its content is correct. For new records, this is simply a Table with field names and field types matching the list. For existing records, including the SharePoint record ID in the table causes it to update that record for each of the Table records.
    I have also consolidated a few things in the code below and am also wondering whether the first varShowPopup22 maybe should be true.
    You also do not generally need to refresh data sources (this adds to the time taken and any galleries or forms based on the List should refresh automatically)

    If(
     Connection.Connected;
     IfError( 
     Patch(
     OnlineData;
    		 ForAll(
    			colPickUp1 As _Data;
     {
     ID: _Data.ID; 
     PickUp: 1
     )
     )
     );
     UpdateContext({varShowPopup22: false});;
     Set(
     ShowAccessError;
     true
     );;
     Set(
     varError;
     FirstError.Message
     );
     Reset(Gallery3_2);;
     UpdateContext(
     {
     varShowPopup22: false;
     checkedout: Blank();
     varall1: false;
     varall: false;
     IsReset: false
     }
     );;
     Clear(colPickUp1);;
     UpdateContext({IsReset: true})
     );
     Set(
     varNoconnection;
     true
     )
    )

     

    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.

    MVP (Business Applications)   Visit my blog Practical Power Apps

  • TimmyBoy Profile Picture
    997 on at

    Hello @WarrenBelz 

    I didn't know about this future ForAll() exercises, was a loop
    I will try-out the code you provided me

    Thank you.

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

#2
M Bilal Khan Profile Picture

M Bilal Khan 320

#3
Mohsin Ali Profile Picture

Mohsin Ali 246

Last 30 days Overall leaderboard