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
Jason ApterJason Apter 

Need to add new trigger - HELP!

Convert lead to opportunity= help

Need to automatically convert leads to opportunity- how to add new APEX trigger and

trigger opptyCreationonConvert on Lead (before update) {     
List<Opportunity> o = new List<Opportunity>();

       for(Lead convertedLead: Trigger.new){
    if(convertedLead.IsConverted == TRUE && convertedLead.ConvertedOpportunityId == NULL){               
        o.add (new Opportunity(
        Name = convertedLead.Company,
        CloseDate = date.today()+90,
        AccountId = convertedLead.ConvertedAccountId,
        StageName = 'Booked Appointment'));
        }
    }
insert o;

}

nitin sharmanitin sharma
See if below link helps you:-
http://www.bulkified.com/How+to+Customize+the+Lead+Conversion+Process+in+Salesforce.com