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

Watch Sessions On Demand!

Continue your learning in our online communities.

SecondImage

PowerApps Monthly Community Call

Next Wednesday, August 21st at 8am PDT

Top Community Contributors for July 2019

Top Community Contributors for July 2019

Let's thank our top community contributors

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

FifthImage

Dynamics 365 and Power Platform April 2019 Release notes

Features releasing from April 2019 through September 2019!

SixthImage

Power Summit Australia 2019

August 20-23rd 2019

Users Online
Currently online: 158 members 4,060 guests
Please welcome our newest community members: