cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
guyinazo
Level 8

Making sure a patch is successful

Is there an easy way to make sure a Patch was successful?  I have the end user entering some demographic data and then saving it and on Success I want a Summary button to enable (instead of its default state of disabled) that will take them to their Summary screen).  And if there is some error in the Patch, I would like it to log and show and error.

 

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User
Super User

Re: Making sure a patch is successful

You can set a variable to be the result of a PATCH operation, e.g.

Set(varReturnedRecord,Patch(MyTable, Defaults(MyTable),{Field: MyValue}))

You can then check to see if that returned record is zero. This is also handy for getting the identifier of a newly created record.

If a varReturnedRecord is empty, I think you can then also use the errors function to determine the error, e.g.

Set(varError, Errors(MyTable, varReturnedRecord))

More info here: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-errors 

To clear errors from a table/record, you can use the Revert function.

1 REPLY 1
Highlighted
Super User
Super User

Re: Making sure a patch is successful

You can set a variable to be the result of a PATCH operation, e.g.

Set(varReturnedRecord,Patch(MyTable, Defaults(MyTable),{Field: MyValue}))

You can then check to see if that returned record is zero. This is also handy for getting the identifier of a newly created record.

If a varReturnedRecord is empty, I think you can then also use the errors function to determine the error, e.g.

Set(varError, Errors(MyTable, varReturnedRecord))

More info here: https://docs.microsoft.com/en-us/powerapps/maker/canvas-apps/functions/function-errors 

To clear errors from a table/record, you can use the Revert function.

Helpful resources

Announcements
firstImage

PowerApps Monthly Community Call!

Join us next Wednesday for our Demo Extravaganza, October 16, 2019 8am PDT.

firstImage

Microsoft Business Applications Virtual Launch Event

Join us for an in-depth look at the new innovations across Dynamics 365 and the Microsoft Power Platform.

firstImage

Watch Sessions On Demand!

Continue your learning in our online communities.

Power Platform 2019 release wave 2 plan

Power Platform 2019 release wave 2 plan

Features releasing from October 2019 through March 2020

FirstImage

Power Platform World Tour

Coming to a city near you

thirdimage

PowerApps Community User Group Member Badge

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

FourthImage

Join PowerApps User Group!!

Connect, share, and learn with your peers year-round

SecondImage

Power Platform Summit North America

Register by September 5 to save $200

Top Kudoed Authors
Users Online
Currently online: 295 members 5,115 guests
Please welcome our newest community members: