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 / Updating a SharePoint ...
Power Apps
Unanswered

Updating a SharePoint list item using variables and Patch Function

(0) ShareShare
ReportReport
Posted on by

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,582 Moderator 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
    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
    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,582 Moderator 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
    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,582 Moderator 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,582 Moderator 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
    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

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

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 329 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 268

Last 30 days Overall leaderboard