I am using the below method in button tag in visualforce page. After insert i want to redirect to the parent record detail page. currently it is not happening. Please help.
public class BIAcontroller
{
public BIAcontroller(ApexPages.StandardController controller)
{
account=new BIA__c();
// other constructor operations
}
public BIA__c account{ get; set; }
// other properties
public PageReference processSelected()
{
//do stuff
insert account;
PageReference nextPage = new PageReference('/' + account.id);
// nextPage.setRedirect(true);
return nextPage;
}
}
Best Answer
Generally if I have an
SObject
and I want to redirect to it viaPageReference
, I will use the following: