cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DevPower
Level: Powered On

How to Print Patch Error

Hi,

 

I'm playing around with PowerApps and trying to build up my skills. One feature I'd like to impliment in the app I'm designing at the moment, is a detailed error notification. This would be good for debugging, and if I can figure out how to save the details of the error I could also perhaps log them to a file at a later date.

 

Here is the code I have at the moment:

 

Patch(
    Table1,
    Defaults(Table1),
    {Fruit: TextInput1.Text},
    {Age: TextInput2.Text}
);
If(
    IsEmpty(Errors(Table1)),
    Notify(
        "Success",
        NotificationType.Success
    ),
    Notify(
        "Error Encountered",
        NotificationType.Error
    )
)

I'd like to change the "Error Encountered" part, to contain the patch error message, which can be seen when in the app studio (see attached - including a clientRequestId and serviceRequestId which I have omitted).

 

Any ideas on how this can be done? Many thanks.

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Super User
Super User

Re: How to Print Patch Error

@DevPower 

Have you looked at the Errors function?

This will give you a Table of Errors which will include more detailed information.

 

Hope this helps.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

2 REPLIES 2
Super User
Super User

Re: How to Print Patch Error

@DevPower 

Have you looked at the Errors function?

This will give you a Table of Errors which will include more detailed information.

 

Hope this helps.

_____________________________________________________________________________________
Digging it? - Click on the Thumbs Up. Solved your problem? - Click on Accept as Solution. Others seeking the same answers will be happy you did.

View solution in original post

DevPower
Level: Powered On

Re: How to Print Patch Error

Thank you for your response. Revisiting that link with fresh eyes, I found the solution.

 

My formula now looks like this and is working:

 

Patch(
    Table1,
    Defaults(Table1),
    {Fruit: TextInput1.Text},
    {Age: TextInput2.Text}
);
If(
    IsEmpty(Errors(Table1)),
    Notify(
        "Success",
        NotificationType.Success
    ),
    Notify(
        First(Errors(Table1)).Message,
        NotificationType.Error
    )
)

Helpful resources

Announcements
Better Together’ Contest Finalists Announced!

'Better Together’ Contest Finalists Announced!

Congrats to the finalists of our ‘Better Together’-themed T-shirt design contest! Click for the top entries.

thirdimage

Power Apps Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

sixthImage

Join THE global Microsoft Power Platform event series

Attend for two days of expert-led learning and innovation on topics like AI and Analytics, powered by Dynamic Communities

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

thirdimage

Microsoft Business Applications Virtual Launch

Join us for the Microsoft Business Applications Virtual Launch Event on Thursday, April 2, 2020, at 8:00 AM PST.

thirdimage

Community Summit North America

Innovate, Collaborate, Grow - The top training and networking event across the globe for Microsoft Business Applications

Top Solution Authors
Top Kudoed Authors
Users online (9,493)