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 a SharePoint ...
Power Apps
Answered

Updating a SharePoint list item using variables and Patch Function

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi all,

 

I am trying to update an existing record of a SharePoint list using the Patch Function.

I am needing to use variables for some of the values. 

 

Patch('Record of Biosecurity Zone Status Changes', 
 {ID: varZSCPlanId},
 {ApplicationStatus: {Value: varZSCTransactionType},
 'Reviewed By': varCurrentUser.Email,
 'Modified By': varCurrentUser.FullName,
 'Review Comments':Substitute(txtReviewComments_ZSC.Text,"""","'")

);

This the code I am currently using however I am getting the following errors:

"The function "Patch" has some invalid arguments",

"Unexpected characters. The formula contains "ParenClose" where "CurlyClose" is expected.

 

Any insight on this would be greatly appreciated 

Categories:
I have the same question (0)
  • SebS Profile Picture
    4,803 Super User 2026 Season 1 on at

    Hello @Anonymous 

     

    Patch('Record of Biosecurity Zone Status Changes', 
     {ID: varZSCPlanId},
     {
    ApplicationStatus: {Value: varZSCTransactionType},
     'Reviewed By': varCurrentUser.Email,
     'Modified By': varCurrentUser.FullName,
     'Review Comments':Substitute(txtReviewComments_ZSC.Text,"""","'")
    
    }
    
    );

     

    I think You forgot to close last } <--- try now

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Anonymous 

    Patch('Record of Biosecurity Zone Status Changes', 
     {ID: varZSCPlanId,
     ApplicationStatus: {Value: varZSCTransactionType},
     'Reviewed By': varCurrentUser.Email,
     'Modified By': varCurrentUser.FullName,
     'Review Comments':Substitute(txtReviewComments_ZSC.Text,"""","'")
     }
    );
  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for pixking up the missing "}" guys.

     

    I'm still getting the "The function "Patch" has some invalid arguments" error along with another one "The type of this argument 'Editor' does not match the expected type 'Record'. Found type 'Text'". 

    Any ideas as to how to fix this?

  • Drrickryp Profile Picture
    Super User 2024 Season 1 on at

    @Anonymous 

    Please post a screenshot of the formula and the error message.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Screenshot 2022-11-21 120125.png

    Screenshot 2022-11-21 115724.pngScreenshot 2022-11-21 115743.png

     

    Here is my code and the errors, sorry I wasn't able to have the errors show in the screenshot

  • SebS Profile Picture
    4,803 Super User 2026 Season 1 on at

    @Anonymous 

     

    The big question is, what kind of column type is "AplicationStatus" is it a Choice type, and how do you create the variable "varZSCTransactionType"  The SharePoint expects a record, but it receives Text do You have a dropdown some ware or a combo box to pick the result, and then you create some variable from it?

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    So "Applicationstatus" is a choice type, "varZSCTransactionType is set above the current function which is in the "Onselect" of a button.

    the full code for the button is:

    Set(varShowSpinner, true);
    Set(
     varZSCTransactionType,
     "Reviewed and Forwarded"
    );
    
    
    Patch('Record of Biosecurity Zone Status Changes', 
     {ID: varZSCPlanId},
     {ApplicationStatus: {Value: varZSCTransasctionType},
     'Reviewed By': varCurrentUser.Email,
     'Modified By': varCurrentUser.FullName,
     'Review Comments':Substitute(txtReviewComments_ZSC.Text,"""","'")
     }
    );
    
    Refresh('Record of Biosecurity Zone Status Changes');
    Set(varShowSpinner, false);

     

  • SebS Profile Picture
    4,803 Super User 2026 Season 1 on at

    @Anonymous 

     

    I see. So it should not create a problem. You create a Text and then apply it directly to the Value of the record by {Value:}, so it should Take it that way.

     

    It must be another column

    try to delete it line by line from top to bottom till all errors clear and then let me know what column actually throwing a Type miss-match from the screen it looks like This variable is an issue, so when You remove the whole line the error should clear itself.

     

     

     

  • Verified answer
    SebS Profile Picture
    4,803 Super User 2026 Season 1 on at

    @Anonymous 

     

    I Just noticed XD

    Are you trying to Patch Modified By 🙂 Remove this It's People complex type, and it's automatically populated by whoever is Logged to power app and Update an item means You should not patch this column

     

    If You really want to Patch to People and Group column You need to use specific Schema here is how it looks

     

     

    'Modified By': Table(
    {
    
     Claims: "i:0#.f|membership|mdevaney@companyname.com",
     Department: "",
     DisplayName: "Matthew Devaney",
     Email: "mdevaney@companyname.com",
     JobTitle: "",
     Picture: ""
    }

     

     

    I never try to Update this field as it's manage mostly by SharePoint so no clue if it even let you 🙂

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    This seemed to be the problem. Thanks!!!

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
11manish Profile Picture

11manish 536

#2
WarrenBelz Profile Picture

WarrenBelz 426 Most Valuable Professional

#3
Haque Profile Picture

Haque 305

Last 30 days Overall leaderboard