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
srk goudsrk goud 

LEAD CONVERSION

converting lead
Trigger AutoConverter on Lead (after insert)
{ LeadStatus convertStatus = [ select MasterLabel from LeadStatus where IsConverted = true limit 1 ];
List<Database.LeadConvert> leadConverts = new List<Database.LeadConvert>();
for (Lead lead: Trigger.new) {
if (!lead.isConverted && lead.WebForm__c == 'Free Trial') {
Database.LeadConvert lc = new Database.LeadConvert();
String oppName = lead.Name;
lc.setLeadId(lead.Id);
lc.setOpportunityName(oppName);
lc.setConvertedStatus(convertStatus.MasterLabel);
leadConverts.add(lc); }
}
if (!leadConverts.isEmpty())
{ List<Database.LeadConvertResult> lcr = Database.convertLead(leadConverts);
}
}
here why we have taken isconverte=true....
srk goudsrk goud
why we taken isconverted=true