Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Apps - Building 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:
  • WarrenBelz Profile Picture
    146,700 Most Valuable Professional on at
    Patch fails but success Notification always displays
    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.
  • CharlesPP Profile Picture
    187 on at
    Patch fails but success Notification always displays
    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
    146,700 Most Valuable Professional on at
    Patch fails but success Notification always displays
    Also try IfError
    IfError(
       Patch(
          MyLib,
          {
      ID: ThisItem.ID,
      MyField: Self.Selected
      } ), Notify("Error", NotificationType.Error, 3000), Notify("Success", NotificationType.Success, 3000) )
     
  • Nirav Raval (Akira28) Profile Picture
    150 Super User 2025 Season 1 on at
    Patch fails but success Notification always displays
    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)
     
  • Suggested answer
    CU15102032-0 Profile Picture
    10 on at
    Patch fails but success Notification always displays

    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.

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

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,700 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard