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

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / How to overcome delega...
Power Apps
Unanswered

How to overcome delegation warning in Powerapps

(1) ShareShare
ReportReport
Posted on by 280
Good day experts! I am having an issue with patch and lookup in PowerApps. I wanted to get rid of the delegation warning. Please note that I have a large data set with more than 10,000 items in SP list. Can you help or suggest any alternatives? Thank you!

Categories:
I have the same question (0)
  • Suggested answer
    WarrenBelz Profile Picture
    152,839 Most Valuable Professional on at
    How to overcome delegation warning in Powerapps
    Assuming you have indexed the ID field in your SP List
    Patch(
       'UBI Identification',
       ForAll(
          Gallery2.AllItems As _Data,
          {
             ID: _Data.ID,
             Status: {Value: "Updated"}
          }
       )
    )
    I am also assuming that Gallery2 is based directly on 'UBI Identification' and has the ID field contained in it (and you do not need Value() if it is already numeric).
    Also note that â€‹â€‹â€‹â€‹â€‹â€‹â€‹ForAll is not designed to be a loop, although it can act that way if it contains an action inside it. ForAll creates a Table, which can be Patched in one action to the data source and will run much faster than individual Patches for each record. If it contains the ID of each record, it will update the specific records, if not it will create new records.
     
    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    LinkedIn    Buy me a coffee
  • scorpio24 Profile Picture
    280 on at
    How to overcome delegation warning in Powerapps
    Hi @WarrenBelz, I am still getting an error using your formula below. (Invalid argument type (Table). Expecting a Record value instead.)
     
    Here's what my collection looks like for your reference. Would like to update all items when "Save Changes" button is clicked, using the ID number highlighted in Green

  • WarrenBelz Profile Picture
    152,839 Most Valuable Professional on at
    How to overcome delegation warning in Powerapps
    You are only dealing with two fields - ID, which we know is a number and Status (which I questioned as to whether it is a (single) Choice field). Can you please post your SharePoint List Settings for Status.
  • msoenmez Profile Picture
    46 on at
    How to overcome delegation warning in Powerapps
    I think you might need to specify the elements as record array while trying to update them.
    Patch will try to create a record, when it has only two parameters. It will try to update the record when it has 3 parameters :  Modify or create a set of records in a data source 
     
    Patch(
       'UBI Identification',
       ForAll(
         Gallery2.AllItems As _Data,
         LookUp('UBI Identification',ID: _Data.ID)
       ),
       ForAll(
          Gallery2.AllItems As _Data,
          {
             ID: _Data.ID,
             Status: {Value: "Updated"}
          }
       )
    )
  • scorpio24 Profile Picture
    280 on at
    How to overcome delegation warning in Powerapps
    Hi @WarrenBelz my Status field is a choice field.
     
    Hi @msoenmez, I tried your formula but still getting an error. Can you please check?
  • Suggested answer
    Robsx Profile Picture
    2 on at
    How to overcome delegation warning in Powerapps
    Hello.
     
    I assume this `ID` field is the default ID generated by SP for your list. Then you need to change the reference to another (duplicate) ID field.
     
    The reason is that, apparently, comparisons on the default ID column of a SP list cannot be delegated. I learned this, when researching on a similar topic.

    Edit: Nope, that's not exactly correct. Looking into the docs again clarifies, that `=` on the ID can indeed be delegated.
  • msoenmez Profile Picture
    46 on at
    How to overcome delegation warning in Powerapps
    My mistake, in the LookUp, I have used ":" instead of "=".  the correct code should be LookUp('UBI Identification',ID= _Data.ID)
     
    Patch(
       'UBI Identification',
       ForAll(
         Gallery2.AllItems As _Data,
         LookUp('UBI Identification',ID= _Data.ID)
       ),
       ForAll(
          Gallery2.AllItems As _Data,
          {
             ID: _Data.ID,
             Status: {Value: "Updated"}
          }
       )
    )
     
  • Verified answer
    WarrenBelz Profile Picture
    152,839 Most Valuable Professional on at
    How to overcome delegation warning in Powerapps
    Please note I am not getting notifications unless you tag me - so I did not see this one. The code I posted earlier should work assuming Status is a (single) Choice column and that Gallery2 contains the ID of the relevant record.
    Patch(
       'UBI Identification',
       ForAll(
          Gallery2.AllItems As _Data,
          {
             ID: _Data.ID,
             Status: {Value: "Updated"}
          }
       )
    )
    There are a few different ways of dealing with ForAll Patches - ForAll is not designed to be a loop, although it can act that way if it contains an action inside it. ForAll creates a Table, which can be Patched in one action to the data source and will run much faster than individual Patches for each record. If it contains the ID of each record, it will update the specific records, if not it will create new records.
    The most efficient is as above and you can also do this (which will do a Patch for each item rather than patching a Table)
    ForAll(
       Gallery2.AllItems As _Data,
       Patch(
          'UBI Identification',
          LookUp(
             'UBI Identification',
             ID = _Data.ID
          ),
          {Status: {Value: "Updated"}}
       )
    )
    They both should work however. If not, what is the Items of Gallery2.
     
    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    LinkedIn    Buy me a coffee
  • scorpio24 Profile Picture
    280 on at
    How to overcome delegation warning in Powerapps
    Thank you all for your help! But what really helped me solve this issue is Robsx answer. Simply by creating a new field (idDelegate) containing the same ID of the item.

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 836 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 327 Super User 2025 Season 2

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 231 Super User 2025 Season 2

Last 30 days Overall leaderboard