• rachit rakesh7
  • NEWBIE
  • 0 Points
  • Member since 2015
  • Salesforce Developer
  • Algoworks

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 2
    Replies
vf code:
<apex:page standardController="Lead" action="{!convertLead}" extensions="ControllerLeadConvertView"> </apex:page>
controller:
public class ControllerLeadConvertView {
  public Id leadId;
    public String convertedAccountId ;
    public ControllerLeadConvertView(ApexPages.StandardController stdController){
        leadId = ApexPages.CurrentPage().getParameters().get('id');
        
    }

     
    public PageReference convertLead(){
    try
    {
    lead leadobj=new Lead();
    leadobj = [select id,MobilePhone,Company from lead where id =:leadId];
    Account a = new Account();
    a.Name =leadobj.Company;  
    insert a;
    PageReference newocp= new PageReference('/'+ a.Id);

     newocp.setRedirect(true);

           return newocp;

     }   
               
    catch(Exception e)
    {
            System.Debug('Error - ControllerLeadConvertView.convertLead - Exception [' + e.getMessage() + ']');
            return null;
    }     
}
}

 
Hi,
I have to increment with 100 in  one custom filed for very 5 minutes using batch class.