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 / Using Update() on a Sh...
Power Apps
Answered

Using Update() on a SharePoint List item? Power Apps complains: "Field 'ID' is required"

(0) ShareShare
ReportReport
Posted on by 10
I intend to use the Update() function to reset a SharePoint List Item to its initial state, for easier testing. Writing out all the columns in Patch() would be a pain.
 
Here's the code I wrote: 
 
Update(
  nameOfSharePointList,
  LookUp(nameOfSharePointList, ID = varSelectedCase.ID),
  {
    Status: "New"
  }
)
 
When I run this, Power Apps complains that I haven't added "ID" to the object in the third parameter. But when I do, it then complains that this column's value is auto-generated and should not be specified. 
 
So I tried to make it look more like the examples posted in the documentation: 
 
Update(
  nameOfSharePointList,
  LookUp(nameOfSharePointList, employeeName = varSelectedCase.employeeName),
  {
    ID: varSelectedCase.ID,
    Status: "New"
  }
)
 
But here, again, it complains that ID is auto-generated and shouldn't be specified... 
 
Does update simply not work with SharePoint Lists?...
Categories:
I have the same question (0)
  • StretchFredrik Profile Picture
    3,395 Super User 2025 Season 2 on at
    Hello,
     
    If you want to update the status, use patch. Update replaces the entire record. 
    I believe the documentation is using a collection, where ID isnt a auto generated column, but in SharePoint it is.
    Patch(
      nameOfSharePointList,
      LookUp(nameOfSharePointList, ID = varSelectedCase.ID),
      {
        Status: "New"
      }
    )
    If my response solved your issue, please mark it as ✅ Accepted Answer and give it a like.
  • FG-18100917-0 Profile Picture
    10 on at
    @StretchFredrik
     
    Ugh, I knew I should not have simplified my object for the purpose of this post... 
     
    To reiterate: "I intend to use the Update() function to reset a SharePoint List Item to its initial state, for easier testing. Writing out all the columns in Patch() would be a pain."
     
    By "initial state" I meant more than just changing the value in the Status column. I included only the Status column for simplicity. 

    The SharePoint List Item has more columns in it, which are currently filled on the Item, which I DO want to clear. That's why I want to use Update. 
     
  • Suggested answer
    StretchFredrik Profile Picture
    3,395 Super User 2025 Season 2 on at
    What you could try is storing the sharepoint list data in a collection and working on that, to then patch the collection to SP again. Not sure if it works, but worth a try.
     
    Clearcollect(colList,your_SP_list);
    Update(
      nameOfSharePointList,
      LookUp(nameOfSharePointList, employeeName = varSelectedCase.employeeName),
      {
        ID: varSelectedCase.ID,
        Status: "New"
      }
    );
    Patch(your_SP_list,colList);
     
    If my response solved your issue, please mark it as ✅ Accepted Answer and give it a like.
  • Suggested answer
    FG-18100917-0 Profile Picture
    10 on at
    Hi again @StretchFredrik, I appreciate your time. 
     
    Unfortunately no combination works. The only way for Patch to clear a column, for example a Text column, is to provide it with a null-like value that corresponds to the column type. Meaning... leaving the column effectively Blank with what you suggested OR presenting it in the patched object as myTextColumn: Blank() does not clear the column. Only myTextColumn: "" clears it. 
     
    So... if I were to use Patch, I would have to literally type out all the columns I want to nullify. Which is what I want to avoid. 
     
    I even tried being smart with the use of Defaults(): 
     
    Patch(
      mySharePointList, 
      LookUp(mySharePointList, ID = varSelectedCase.ID),
      Patch(
        Defaults(mySharePointList),
        {
          Status: "New"
        }
      )
    )
     
    hoping that - since most of my SharePoint columns have empty Default values - it would clear them. But it does not. It does reset, for example, boolean columns to their default value, but does not clear columns which have their defaults left empty. 
     
    To summarize: Update does not work as I would like it to work with SharePoint Lists.
  • Verified answer
    WarrenBelz Profile Picture
    153,079 Most Valuable Professional on at
    I will add a comment here that may assist.
    Update replaces the entire record, so the fundamental issue you have is that the ID is a read-only field and cannot be replaced (exactly the message you are getting) - it only really works on Collections.
     
    So you really need to endure Writing out all the columns in Patch() would be a pain - it is is the only way to achieve what you need to "reset" the record. A few minutes coding is really not that much of an imposition.

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 320 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard