cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
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
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
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.