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 / Patch a Dataverse tabl...
Power Apps
Unanswered

Patch a Dataverse table using checkbox

(0) ShareShare
ReportReport
Posted on by 421

Hi everyone.

 

I am trying to patch a table using checkboxes.  I am using a dropdown to pull in the reference in the patch, but I am getting the error below.

ckserra33_0-1662657983138.png

 

When I check the checkbox on Checkbox9, I want Task1 on the datasource NSOStoreInfos to change to true.  Ive never patched this way so I am struggling!

 

Thanks for any help!

 

Chris

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

    @ckserra33 

    Couple things here...

    1) Your patch formula is not specifying records or tables.  You have text in it.  That will not work.

    2) Avoid using the SelectedText property on your dropdown as this is a deprecated property.

     

    The question now is, what is the name of the primary column of your datasource?  How is the dropdown (as you are envisioning it) to reference the item?

  • ckserra33 Profile Picture
    421 on at

    @RandyHayes Hi Randy,

     

    The primary column is Name, I THINK I would like to use that as a lookup to be able to patch Task1.  So in this instance, my drop down is currently NSOStoreInfos .  I would like to patch the column Task1 based off of that.

     

    ckserra33_0-1662659738217.png

     

     

    Do I need to AddColumns to bring in Task1 to the dropdown?

     

     

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

    @ckserra33 

    I believe you are trying to have a dropdown be the selector of the column you want to update.  Is that what I'm picking up??  If so, you can't do that in PowerApps, you must declare the column in your formula.

     

    Perhaps I am not getting what you are doing with the dropdown!?

     

    But, in general, the Patch should be like this:

    Patch(NSOStoreInfos, {primaryKeyName: PrimaryKeyOfRecord, Task1: true})

     

    So, whatever the primary key column name is (you can verify by looking at the schema definition in your table settings) and whatever the primary key is for the record you want to patch...that is what you need.

  • ckserra33 Profile Picture
    421 on at

    @RandyHayes I am trying to use the Dropdown to select the record to update and the Task1 will be the column of the record to update.

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

    @ckserra33 

    Right...so if Name is the primary key, then your dropdown will have that and you can specify it in your formula:

    Patch(NSOStoreInfos, {Name: Dropdown10.Selected.Name, Task1: true})

     

    But, I am doubting that Name is the primary key in your table.  You need to look at the schema of your table and find out what is the primary key and then substitute that in the above.  Your dropdown (being based on the table entirely) will have all the columns beside Name, so you can use any one you want (well...the proper primary key is what I mean).

  • ckserra33 Profile Picture
    421 on at

    Hi @RandyHayes 

    So your formula works but it adds a record, not updating an existing record.  It does change Task1 to true however.

     

    Here are screen shots of the Name column showing its Primary, but maybe I meant to say the NSOStoreInfo column is the Unique Identifier?  

     

    ckserra33_0-1662663801671.png

    Thanks again!

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

    @ckserra33 

    Yes, then it is not the primary key you are specifying correctly! 

    Patch will update a record if the primary key is supplied.  If not, it will create a record.

     

    Don't confuse the Primary name column with the primary key. What you want to find in your schema will be named as the unique identifier.  Usually the name of the table itself.  Then you need to use the schema name in the patch statement.

    Yours shows NSOStoreInfo as the primary key.

    So your patch should be:

    Patch(NSOStoreInfos, {cr3db_NSOStoreInfoId: Dropdown10.Selected.cr3db_NSOStoreInfoId, Task1: true})

     

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

#2
Mohsin Ali Profile Picture

Mohsin Ali 347

#3
WarrenBelz Profile Picture

WarrenBelz 254 Most Valuable Professional

Last 30 days Overall leaderboard