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 Apps
Answered

Help with patch

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi

I'm struggling with patch.

I have a SPO list and a canvas app form.

User1 has completed PartA, I've used deep linking to send User2 an email to direct them to the same item.

But when I use submitform function it creates a new item in SPO.

I understand I need to use Patch, but need help with putting the code together please.

 

 

 

Categories:
I have the same question (0)
  • Ben-Western Profile Picture
    77 on at

    Hi @Anonymous  ,

     

    To Patch() the syntax is as follows: 

     

    //For a new row
    Patch(datasource, default(datasource), {item: "content"})
    
    //Updating an existing row
    Patch(datasource, gallery1.selected, {item: "content"})

     

    Patch Example: https://www.youtube.com/watch?v=yS6mTRlmuls

    Microsoft Docs: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-patch

     

    Hope this helps!

     

    Regards,

     

    Benjamin Western | Automation Specialist

    NextStep Creations

     

    Taking your PowerApps Skill the NextStep

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Ben-Western 

    Thanks, still getting used to this.

    If I want to update the fields found in Form1_8 what would the syntax be like this, as i'm not viewing the existing item form a gallery, rather its from an email that User2 has received?

     

    Patch(ListName, gallery1.selected, //Not sure what I put here {item: "content"}),//again not sure what I put here

  • Ben-Western Profile Picture
    77 on at

    Patch(ListName, gallery1.selected, //Not sure what I put here {item: "content"}),//again not sure what I put here

     

    So for you gallery1.selected will be whatever the "item" of your form is ( this is the item that is used to populate the form)

     

    {item: "content"} is broken down into Column Name and Value

    So for name it would be {name: "ben"} if I wanted to patch name and gender it would be {name: "ben", gender: "male"}

     

    Hope this helps!

     

    Regards,

     

    Benjamin Western | Automation Specialist

    NextStep Creations

     

    Taking your PowerApps Skill the NextStep

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Hi @Ben-Western 

    For Form1_8 my items property points to Defaults(ListName) but if i type in Defaults(ListName) it then creates a new record.

     

    If I understand correctly and as I want to patch the whole form, i.e. Form1_8 the {item: "content"}  would be something like this which i don't think will work:

     

    Patch(ListName, Defaults(ListName),{item:Form1_8});

  • WarrenBelz Profile Picture
    156,456 Most Valuable Professional on at

    Hi @Anonymous ,

    Going back to your original post, SubmitForm will only create a new record when form's Mode is FormMode.New, however back to your Patch you are correct that Defaults(ListName) will create a new record in Patch - you need to tell Patch which item to update.

    So assuming you are doing this from a button not on the form and the Item of the Form is GalleryName.Selected, your Patch could be (substituting the field names and your form control values - note that you only need to update the fields that may change)

    Patch(
     ListName,
     {ID:GalleryName.Selected.ID},
     {
     FieldName1:Value1,
     FieldName2:Value2,
     FieldName3:Value3 //and so on for the rest
     }
    }

     

    Please click Accept as solution 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 Thumbs Up.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    HI @WarrenBelz 

    I ended up using a similar set up i had previously used.

    I used the SubmitForm on this screen, but I have now set my Item property of the form to VarRecord, it writes back to the same item.

    I heard someone say don't over think it... I should have realised it would work.

    Thanks for your response

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

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 356 Most Valuable Professional

#2
11manish Profile Picture

11manish 225 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 211

Last 30 days Overall leaderboard