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 command is creat...
Power Apps
Answered

Patch command is creating a new row rather than updating

(0) ShareShare
ReportReport
Posted on by 16

I am trying to Update a row in the dataverse using the Patch command but it is adding a new row instead. I have created a key column in both tables to Lookup on. Despite there being a match, it is creating a new row.

 

Here is the syntax I am trying to use:

 

ForAll(

//"SIPGridData10"     is a collection I want to patch to the table (SIP_Sales Summary Calculationss) in the dataverse

SIPGridData10,

Patch(
           'SIP_Sales Summary Calculationss',
                         LookUp('SIP_Sales Summary Calculationss',

//   'Summary Table Key' is the column ID in both the collection and the dataverse table
                         'Summary Table Key'= ThisRecord.'Summary Table Key),
           {

// These are the records I want to patch to the dataverse table (SIP_Sales Summary Calculationss)
                 'Summary Table Key': ThisRecord.'Summary Table Key',
                   Area_Test: Text(ThisRecord.Areap),
                  Prodhlvl3: Text(ThisRecord.PHLvl3p),
                 'Annu.figs':ThisRecord.Ann_netvalue
            }
)
)

I have the same question (0)
  • v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @oladimejishodip ,

     

    Please try this:

    ForAll(
    
    //"SIPGridData10" is a collection I want to patch to the table (SIP_Sales Summary Calculationss) in the dataverse
    
    SIPGridData10 As temp,
    
    Patch(
     'SIP_Sales Summary Calculationss',
     LookUp('SIP_Sales Summary Calculationss',
    
    // 'Summary Table Key' is the column ID in both the collection and the dataverse table
     'Summary Table Key'= temp.'Summary Table Key),
     {
    
    // These are the records I want to patch to the dataverse table (SIP_Sales Summary Calculationss)
     'Summary Table Key': temp.'Summary Table Key',
     Area_Test: Text(temp.Areap),
     Prodhlvl3: Text(temp.PHLvl3p),
     'Annu.figs':temp.Ann_netvalue
     }
    )
    )

     

    Best Regards,

    Wearsky

  • oladimejishodip Profile Picture
    16 on at

    patchs.png

  • oladimejishodip Profile Picture
    16 on at

    Thank you for the support. I got this syntax error patchs.png

  • Verified answer
    v-xiaochen-msft Profile Picture
    Microsoft Employee on at

    Hi @oladimejishodip ,

     

    Try this:

    ForAll(
    
    //"SIPGridData10" is a collection I want to patch to the table (SIP_Sales Summary Calculationss) in the dataverse
    
    SIPGridData10 As temp,
    
    Patch(
     'SIP_Sales Summary Calculationss',
     LookUp('SIP_Sales Summary Calculationss',
    
    // 'Summary Table Key' is the column ID in both the collection and the dataverse table
     'Summary Table Key'= temp.'Summary Table Key'),
     {
    
    // These are the records I want to patch to the dataverse table (SIP_Sales Summary Calculationss)
     'Summary Table Key': temp.'Summary Table Key',
     Area_Test: Text(temp.Areap),
     Prodhlvl3: Text(temp.PHLvl3p),
     'Annu.figs':temp.Ann_netvalue
     }
    )
    )
  • oladimejishodip Profile Picture
    16 on at

    @v-xiaochen-msft 

    Thank you for your help. The code works perfectly. However, I want to ask why it was necessary to load into temp ( rename the collection) to sync back correctly.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Apps

#1
wolenberg_ Profile Picture

wolenberg_ 119 Super User 2026 Season 1

#2
WarrenBelz Profile Picture

WarrenBelz 107 Most Valuable Professional

#3
Haque Profile Picture

Haque 103

Last 30 days Overall leaderboard