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 / How to patch data to a...
Power Apps
Answered

How to patch data to a Dataverse table

(1) ShareShare
ReportReport
Posted on by 362

Hi, I have never used Dataverse tables with PowerApps, and I assumed that PowerApps formulas would be the same whether I used them with SharePoint as a data source, or Dataverse.

 

I.e., function Patch. I am trying to patch the value stored in a text label in a form to a Dataverse table field named 'ParentID'. The syntax I'm using is Patch('MyDataverseTable',ThisItem.'ParentID',TextLabel) and PA won't accept it, whether the form Default Mode is New or Edit.

Categories:
I have the same question (0)
  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    Hi @Gilmour 

    Using Patch to edit an existing record can often look something like this:

    Patch(MyDataverseTable, LookUp(MyDataverseTable, PrimaryKeyField = ThisItem.PrimaryKeyField), {'ParentID': TextLabel.Text})
    

     

    Replace 'PrimaryKeyField' with the primary key column name of your Dataverse table, and 'MyDataverseTable' with the name of your actual Dataverse table. ThisItem.PrimaryKeyField refers to the unique identifier of the record you want to modify.

    Here, we're telling PowerApps to find a record in 'MyDataverseTable' where the primary key is equal to ThisItem.PrimaryKeyField and then update the 'ParentID' of that record with the text from TextLabel.

    Make sure that TextLabel is the correct name of your text label and that TextLabel.Text returns the value you expect.

    If you are trying to make a new row/record it would be something like:

    Patch(MyDataverseTable,Defaults(MyDataverseTable), {'ParentID': TextLabel.Text})
    

     

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    I read it again and noticed you mentioned using a form, the SubmitForm() function lets you submit the whole form and it's data to updated records in the datasource if you want to patch use what i previously suggested but if you are trying to submit form then yehp just use submitform

  • Gilmour Profile Picture
    362 on at

    Thank you @AJ_Z . I am going to give it a try. I am wondering, what if I am trying to create a new item instead of editing an existing one?

  • Verified answer
    AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    Are you trying to do this with a Form if so have the formmode in new. If you are trying to use the patch function it would be similar to what i suggested:

    Patch(MyDataverseTable,Defaults(MyDataverseTable), {'ParentID': TextLabel.Text})
  • Gilmour Profile Picture
    362 on at

    Thank you @AJ_Z. Pls disregard my previous reply: your first one already answered that! Thank you. I'll give it a try!

     

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    Let me know how it goes or if you have some more questions on it 🙂

  • Gilmour Profile Picture
    362 on at

    No, @AJ_Z , it worked great. Thank you!

  • AJ_Z Profile Picture
    3,711 Super User 2024 Season 1 on at

    I am glad I could help 🙂

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

#2
11manish Profile Picture

11manish 214 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 185

Last 30 days Overall leaderboard