You need to sign in to do that
Don't have an account?

PageReference not working help me ...
public with sharing class leadConvert {
public Account acc { get; set; }
public Lead led{ get; set; }
public leadConvert(){
led= new Lead();
}
public List<Account> acclist{get;set;}
public void accounts()
{
Lead l=new Lead();
l.LastName=led.LastName;
l.Company=led.Company;
l.Status=led.Status;
insert l;
Database.LeadConvert lc = new Database.LeadConvert();
lc.setLeadId(l.id);
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
lc.setConvertedStatus(convertStatus.MasterLabel);
Database.LeadConvertResult lcr = Database.convertLead(lc);
redirect();
}
public PageReference redirect(){
System.debug('lak');
PageReference pageRef = new PageReference('https://www.google.co.in/?gfe_rd=cr&ei=o96dVtK-BujI8AeDzoWYAw&gws_rd=ssl');
// pageRef.setRedirect(true);
return pageRef;
}
}
public Account acc { get; set; }
public Lead led{ get; set; }
public leadConvert(){
led= new Lead();
}
public List<Account> acclist{get;set;}
public void accounts()
{
Lead l=new Lead();
l.LastName=led.LastName;
l.Company=led.Company;
l.Status=led.Status;
insert l;
Database.LeadConvert lc = new Database.LeadConvert();
lc.setLeadId(l.id);
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
lc.setConvertedStatus(convertStatus.MasterLabel);
Database.LeadConvertResult lcr = Database.convertLead(lc);
redirect();
}
public PageReference redirect(){
System.debug('lak');
PageReference pageRef = new PageReference('https://www.google.co.in/?gfe_rd=cr&ei=o96dVtK-BujI8AeDzoWYAw&gws_rd=ssl');
// pageRef.setRedirect(true);
return pageRef;
}
}
In this method " public void accounts()" your are returning Void.
And you can print the system.debug('----'+redirect());
If I am wrong you are creating your on pagerefernce Url.
-thanks
Ashlekh Gera
All Answers
commented out
but not working
Can you please let me know what this issue you are facing and what do you want to acheive?
-Thanks
Ashlekh Gera
lead convert working
PageReference not working
in case PageReference cannot return the url
In this method " public void accounts()" your are returning Void.
And you can print the system.debug('----'+redirect());
If I am wrong you are creating your on pagerefernce Url.
-thanks
Ashlekh Gera