You need to sign in to do that
Don't have an account?
prathap pendem
pageReference Errors
public class pageref{
Account account;
public Account getAccount(){
if(account==null){
account =new Account();}
return account;
}
public pageReference save(){
insert account;
PageReference acctPage = new ApexPages.StandardController(account).view();
acctPage.setRedirect(true);
return acctPage;
}
}
Error: Illigal assignment from system.pagereference to pagreference
can any body plz help me?
Prathap,
Try the below code,it worked for me :-
public class mySecondController {
Account account;
public Account getAccount() {
if(account == null) account = new Account();
return account;
}
public PageReference save() {
// Add the account to the database.
insert account;
// Send the user to the detail page for the new account.
PageReference acctPage = new ApexPages.StandardController(account).view();
acctPage.setRedirect(true);
return acctPage;
}
}
Hi vinit
that code also not working for me ,same error i am getting. do you know why it is happening.
Not sure as why it is not working for me because it is working for me.Can you check debug logs if possible.
Hi vinit,
I tested the same code in my free edition, it is working, but it wont for developer edition. do you have any idea