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 / Error Latch: UpdateCon...
Power Apps
Unanswered

Error Latch: UpdateContext({x: Patch(x,...)})

(0) ShareShare
ReportReport
Posted on by 26

I've noticed an annoying trap in PowerApps recently. I have several elements on a page that update parts of a record in a context variable, using the form:

 

UpdateContext({ Record: Patch(Record, {field: changedvalue}) })

However, if I make a mistake in one of these, it forces Record to be of type Error. Unfortunately, even if I fix the issue, the line above in other parts of the page latches Record to be of type Error, as Patch(<Error>,...) returns a type <Error>.

 

The only way to clear this, I've found, is to comment out all of these UpdateContexts, and then uncomment them back into the project. 

 

I've found that even leaving the page and returning doesn't resolve the issue. Ideally, PowerApps could recalculate Errors in these recursive situations, or provide a a mechanism to allow you to reset the Error, and try again.

 

Is there any other methods of resolving this issue? 

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

    Hi @bpm ,

     

    I did a test on my side, and had the same issue with you.

    Once the Record is locked to be Error type, it would not work any more even it is corrected, unless remove all related formulas.

    Maybe you can try to use IfError function to avoid the mistakes, though I'm not sure if it is suitable for your scenario.

    Overmore, you can submit an idea to PowerApps Ideas Forum to optimize recursive situations: https://powerusers.microsoft.com/t5/PowerApps-Ideas/idb-p/PowerAppsIdeas

     

    Best regards,

    Sik

  • benny-moore Profile Picture
    26 on at

    Thanks Sik, I did find another workaround using IsError. I replaced all the instances of:

    UpdatedContext({x: Patch(x, ...) })

    with

    UpdateContext({x: Patch(If(IsError(x), Defaults('[dbo].[TableX]'), x), ...)})

    and similarly, where I am attempting to get the new ID from a Patch to a table:

    UpdateContext({x: Patch('[dbo].[TableX]', Defaults('[dbo].[TableX]'), If(IsError(x), {}, x), ...)})

    This at least prevents the Error from propergating back to affect the type of X, and now can't latch the error.

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

#3
MS.Ragavendar Profile Picture

MS.Ragavendar 150 Super User 2026 Season 2

Last 30 days Overall leaderboard