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 / The function 'Patch' h...
Power Apps
Answered

The function 'Patch' has some invalid arguments.

(0) ShareShare
ReportReport
Posted on by 318

I have 2 SharePoint lists in which the Second List references its data from the first List.

 

I am trying to Patch a code that should EDIT the data of the selected data, but I am hitting the error below. If someone could help me please I would really appreciate.

 

The INSERT Patch works but not the UPDATE one.

 

genarich_0-1628181330040.png

 

Here is the code for reference:

 

If(
varMode = "New",
Patch(
'Travel Request Approver Details',
Defaults('Travel Request Approver Details'),
{
Title: varRecord.'Created By'.DisplayName,
Approver: varRecord.Manager,
ApproverActionOn: Now(),
MasterFormID: varRecord.ID,
Master_x0020_Form_x0020_ID_x0020: {
Id: Value(varRecord.ID),
Value: varRecord.ID
},
ApproverOrder: 1,
Comments: DataCardValue1.Text
}
),

Patch(
'Travel Request Approver Details',
ThisItem,//varRecord.ID,
{
Title: varRecord.'Created By'.DisplayName,
Approver: varRecord.Manager,
//'Approver Action':"Awaiting Manager Approval",
// ApproverActionOn: Now(),
// MasterFormID: varRecord.ID,
// ApproverOrder: 1,
/* Master_x0020_Form_x0020_ID_x0020: {
Id: Value(varRecord.ID),
Value: varRecord.ID
},*/
Comments: varRecord.Comments//DataCardValue1.Text
}
)
)

 

Categories:
  • PriyankaGeethik Profile Picture
    3,320 Super User 2024 Season 1 on at

    Hi @genarich ,

     

    I think the issue is with Comments: varRecord.Comments//DataCardValue1.Text. 

    You are again adding the same comment ? 

  • Nogueira1306 Profile Picture
    7,390 Super User 2024 Season 1 on at

    Patch(
    'Travel Request Approver Details',
    Defaults('Travel Request Approver Details'),//varRecord.ID,
    {
    Title: varRecord.'Created By'.DisplayName,
    Approver: varRecord.Manager,
    //'Approver Action':"Awaiting Manager Approval",
    // ApproverActionOn: Now(),
    // MasterFormID: varRecord.ID,
    // ApproverOrder: 1,
    /* Master_x0020_Form_x0020_ID_x0020: {
    Id: Value(varRecord.ID),
    Value: varRecord.ID
    },*/
    Comments: varRecord.Comments//DataCardValue1.Text
    }
    )
    )

     

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @genarich 

    This seems to be in a Form...is there any reason you're not using the SubmitForm function to perform this action?  Or is it that you are trying to update another list and this is in your OnSuccess action of your form?

  • genarich Profile Picture
    318 on at

    Thank you but I am trying to UPDATE a record on the SharePoint list not insert a new one. The code you gave creates a new record.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @genarich 

    Can you provide a little more detail on where you are putting this formula and if this is an insert/update to a separate list (beside what the form is referring to), what is the connection between the form record and the second list record?

  • genarich Profile Picture
    318 on at

    Thank you! Below is the detailed info. Your help would be really appreciated..

     

    So, I am developing a Travel Request app where 2 SharePoint lists would be used as the data source.

    The 1st SP List is where the following field data are stored.

    The 2nd SP List is a LookUp table of the 1st list.

    PowerApp form:

    genarich_0-1628182969701.png

    1st SP List:

    genarich_1-1628183214116.png

    2nd SP List:

    genarich_2-1628183237311.png

     

    Now I am trying to code a Patch argument where if the form is updated it would not only update the 1st SP List but also the 2nd one.

     

    I could only do insertion of a new record for the 2nd SP List but not being able to update it. The below is the issue I am experiencing.

     

    genarich_3-1628183463569.png

     

    @PriyankaGeethik Here is also my reply on your question

  • genarich Profile Picture
    318 on at

    @RandyHayes 

    This seems to be in a Form...is there any reason you're not using the SubmitForm function to perform this action?  Or is it that you are trying to update another list and this is in your OnSuccess action of your form?

     

    Your latter question is what I am trying to achieve. I have sent a detailed info of my flow.

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @genarich 

    Where are you putting this formula??

  • genarich Profile Picture
    318 on at

    OnSuccess property

  • RandyHayes Profile Picture
    76,299 Super User 2024 Season 1 on at

    @genarich 

    Very good.  Thank you for providing details.

    One final question (hopefully) - what is varRecord in your formula?

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

#2
WarrenBelz Profile Picture

WarrenBelz 189 Most Valuable Professional

#3
Mohsin Ali Profile Picture

Mohsin Ali 139

Last 30 days Overall leaderboard