top of page
Search

How to validate a PATCH function is successful or failure

in this post let us see, how can we validate a PATCH function is successful or failure


we can leverage this with "two forms" or "PATCH used against controls" on canvas app


with two forms:

  • frmStudentGenInfo

  • frmStudentContactInfo

on SUBMIT button use the below expression

IfError(Patch(Students,Defaults(Students), frmStudentGenInfo.Updates,frmStudentContactInfo.Updates),Set(varSuccess,true);Set(varFailure,false),Set(varFailure,true);Set(varSuccess,false));If(varSuccess,Navigate('Success Screen'),If(varFailure,Navigate('Failure Screen')))

with controls on canvas app:

IfError(Patch(
    Students,
    Defaults(Students),{studentName: txtStudentName, email: txtStudentEmail}),Set(varSuccess,true); Set(varFailure,false), Set(varFailure,true);Set(varSuccess,false));
If(varSuccess,Navigate('Success Screen'),If(varFailure,Navigate('Failure Screen')))

So, basically we are setting up two variable values - to take respective actions based on the IfError function.


If the PATCH is successful - redirecting user to SUCESS SCREEN

If the PATCH is failed- redirecting user to Failure SCREEN (to show appropriate message)

ree

 
 
 

Comments


bottom of page