You need to sign in to do that
Don't have an account?
Jimmy Trinh
My VisualForce Page is not redirecting after save
Hi in my Controller Extension I have a save method that will insert the record and then calls a PageReference method to redirect the page to a thank you page only if the save was successful. I have my code below and and input or assistance will be helpful.
public void saveObject(){
if(!NAME)
checkReqName();
if(!EMAIL)
ValidateEmail();
if(!EMPLOYID)
checkEmpId();
if(NAME && EMAIL && EMPLOYID){
myTask.Status__c = 'New';
insert myTask;
myTask = null;
NAME = false;
EMAIL = false;
EMPLOYID = false;
thankYou();
}
}
public PageReference thankYou(){
System.debug('Entered page redirect');
PageReference thankYouPage = Page.ThankYou;
thankYouPage.setRedirect(true);
return thankYouPage;
}
public void saveObject(){
if(!NAME)
checkReqName();
if(!EMAIL)
ValidateEmail();
if(!EMPLOYID)
checkEmpId();
if(NAME && EMAIL && EMPLOYID){
myTask.Status__c = 'New';
insert myTask;
myTask = null;
NAME = false;
EMAIL = false;
EMPLOYID = false;
thankYou();
}
}
public PageReference thankYou(){
System.debug('Entered page redirect');
PageReference thankYouPage = Page.ThankYou;
thankYouPage.setRedirect(true);
return thankYouPage;
}
MOdify your method like this.
Let me know if it helps.
Make it as best answer if it helps.
Thanks.