cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Advocate V
Advocate V

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.

View solution in original post

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.

View solution in original post

Helpful resources

Announcements
Check this Out

Helpful information

Featuring samples like Return to the Workplace and Emergency Response Applications

August 2020 Community Challenge: Can You Solve These?

August 2020 Community Challenge: Can You Solve These?

We're excited to announce our first cross-community 'Can You Solve These?' challenge!

secondImage

Return to Workplace

Reopen responsibly, monitor intelligently, and protect continuously with solutions for a safer work environment.

secondImage

Super Users Coming in August

We are excited for the next Super User season.

secondImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

Top Solution Authors
Top Kudoed Authors
Users online (3,805)