function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
lakshmi ganapathirajulakshmi ganapathiraju 

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;
     
 
       
     }     

}
Best Answer chosen by lakshmi ganapathiraju
AshlekhAshlekh
Hi,

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

Mathew Andresen 5Mathew Andresen 5
you do have 
pageRef.setRedirect(true);

commented out
lakshmi ganapathirajulakshmi ganapathiraju
thanks for your responce 
but not working 
AshlekhAshlekh
Hi,

Can you please let me know what this issue you are facing and what do you want to acheive?

-Thanks
Ashlekh Gera
lakshmi ganapathirajulakshmi ganapathiraju
i am doing   Database.LeadConvert lc = new Database.LeadConvert();  lead convert after PageReference 
 lead convert working
PageReference not working 
in case  PageReference cannot return the url




 
AshlekhAshlekh
Hi,

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
This was selected as the best answer
lakshmi ganapathirajulakshmi ganapathiraju
Thank q so much it's working