3:11 PM ssaikgame
trigger ConvertLeadtrigger on Lead (after insert,after update) {
Integer Count =0;
Database.LeadConvert[] leadCollectionArray = new Database.LeadConvert[trigger.new.size()] ;
for(Lead Lea : trigger.new){
if(Lea.rating == 'Hot'){
Database.LeadConvert convLead = new database.LeadConvert();
convLead .setLeadId(Lea.Id);
convLead.setConvertedStatus('Closed - Converted');
convLead .setDoNotCreateOpportunity(true);
leadCollectionArray[count] = convLead ;
count++;
}
}
Database.LeadConvertResult[] LeaConvResults = Database.convertLead(leadCollectionArray,false);
}
If you need to create manually and need to update more fields, go for this example.
0 comments:
Post a Comment