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 / Unable to Patch Datave...
Power Apps
Answered

Unable to Patch Dataverse Table

(0) ShareShare
ReportReport
Posted on by 1,142

Thank you for taking the time to read my question.

 

I have the following code that runs (without errors from what I can tell), but when I refresh the data in Excel of my Dataverse table, the value I'm trying to update, is not changed. I also made a Gallery filtered to the record I'm trying to update and the price does not change in the Gallery either.

 

ForAll(
 galUpdatePrices.AllItems As galItems,
 If(
 IsBlank(
 LookUp(
 PriceLists,
 And(
 PriceListCode = galItems.cra98_PriceListCode,
 ItemCode = galItems.cra98_ItemCode
 )
 )
 ),
 Patch(PriceLists,Defaults(PriceLists),{Price:Value(galItems.cra98_Price)}),
 Patch(PriceLists,LookUp(PriceLists,And(PriceListCode = galItems.cra98_PriceListCode,ItemCode = galItems.cra98_ItemCode),{Price:Value(galItems.cra98_Price)}))
 )
);

//Patch(PriceLists,LookUp(PriceLists,And(PriceListCode = "42ABCFS",ItemCode = "10876045"),{Price:Value("7450.00")}))

 

I also tried just simply running the Patch() statement and nothing changed in my table either. I really don't know what I'm doing wrong!

 

Here is my Dataverse table:

iwonder_0-1636073635602.png

 

any help would be great!

 

Thanks all,

 

Categories:
I have the same question (0)
  • Verified answer
    WarrenBelz Profile Picture
    155,224 Most Valuable Professional on at

    Hi @iwonder ,

    I am not a Dataverse user, but try the below with your unique identifier (I believe GUID) where I have ID

    ForAll(
     galUpdatePrices.AllItems As galItems,
     With(
     {
     wItem:
     LookUp(
     PriceLists,
     PriceListCode = galItems.cra98_PriceListCode && 
     ItemCode = galItems.cra98_ItemCode
     )
     )
     ),
     Patch(
     PriceLists,
     If(
     IsBlank(galItems.ID),
     Defaults(PriceLists),
     {ID:galItems.ID}
     ),
     {Price:Value(galItems.cra98_Price)}
     )
    )

     

    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.

    Visit my blog Practical Power Apps

  • iwonder Profile Picture
    1,142 on at

    Hi Warren,

     

    Thank you for a great suggestion!

     

    I took your idea and applied it this way and it worked!

     

    Thanks

     

    ForAll(
     galUpdatePrices.AllItems As galItems,
     With(
     {
     TheID: LookUp(
     PriceLists,
     And(
     PriceListCode = galItems.cra98_PriceListCode,
     ItemCode = galItems.cra98_ItemCode
     ),
     PriceLists
     )
     },
     Patch(
     PriceLists,
     If(
     IsBlank(TheID),
     Defaults(PriceLists),
     {PriceLists: TheID}
     ),
     {Price: Value(galItems.cra98_Price)}
     )
     )
    )

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Apps

#1
Vish WR Profile Picture

Vish WR 762

#2
11manish Profile Picture

11manish 640

#3
Valantis Profile Picture

Valantis 548

Last 30 days Overall leaderboard