web
You’re offline. This is a read only version of the page.
close
Skip to main content

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Apps / Patch fails but succes...
Power Apps
Suggested Answer

Patch fails but success Notification always displays

(1) ShareShare
ReportReport
Posted on by 187
Hello,

I'm encountering an issue where my Patch function fails as expected (due to a document being open and locked by another user), but the success notification is still displayed. Here’s the code I’m using:

If(
    IsError(
        Patch(
            MyLib,
            LookUp(MyLib, ID = ThisItem.ID),
            {
                MyField: Self.Selected
            }
        )
    ),
    Notify("Error", NotificationType.Error, 3000),
    Notify("Success", NotificationType.Success, 3000)
)

It seems like IsError isn't properly capturing the error.

Does IsError not handle certain errors (like file locks) properly? What’s the correct way to manage these types of errors in Power Apps?

Thank you,

Charles

Categories:
I have the same question (0)
  • Suggested answer
    CU15102032-0 Profile Picture
    10 on at

    The Patch function itself doesn’t return an error flag that IsError can catch for data-related issues. It simply performs the action, and if there’s an issue (like a file lock), PowerApps doesn’t consider that an "error" for the IsError function to detect.

    Use the Errors function, which is designed to detect and handle data-related issues from your data source.

  • Nirav Raval (Akira28) Profile Picture
    153 Moderator on at
    Hi  CharlesPP  ,

    Try the below code, may be that work around helps.🤞
     
    Patch(
        MyLib,
        LookUp(MyLib, ID = ThisItem.ID),
        { MyField: Self.Selected }
    );
    If(
        CountRows(Errors(MyLib)) > 0,
        Notify("Error", NotificationType.Error, 3000),
        Notify("Success", NotificationType.Success, 3000)
    )
     
    If this post solved your issue, clicking 'Does this answer your question' will help others discover the solution and close the topic. If you found it helpful, a Like would be awesome!
     
     
    Regards,
    Nirav J Raval (Akira28)
     
  • WarrenBelz Profile Picture
    153,127 Most Valuable Professional on at
    Also try IfError
    IfError(
       Patch(
          MyLib,
          {
      ID: ThisItem.ID,
      MyField: Self.Selected
      } ), Notify("Error", NotificationType.Error, 3000), Notify("Success", NotificationType.Success, 3000) )
     
  • CharlesPP Profile Picture
    187 on at
    Thanks for your answers.

    @WarrenBelz, IfError didn't detect the error, exactly like IsError.

    @Nirav (Akira28) and @CU15102032-0, this solution works, but I still get the standard error notification and my own notification. Is there any way to have only my own notification?

    Thank you very much!
  • WarrenBelz Profile Picture
    153,127 Most Valuable Professional on at
    I will bow out here - just note that IfError/IsError are designed to "suppress" system errors and replace them with something meaningful (I am surprised that neither work for you). If you do not use one of them, you will get the system 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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Apps

#1
WarrenBelz Profile Picture

WarrenBelz 765 Most Valuable Professional

#2
Michael E. Gernaey Profile Picture

Michael E. Gernaey 343 Super User 2025 Season 2

#3
Power Platform 1919 Profile Picture

Power Platform 1919 272

Last 30 days Overall leaderboard