You need to sign in to do that
Don't have an account?
anil87
Mass lead converter
Hi Everyone,
We'd like to convert multiple leads into Multiple Person Account & Opportunities. They should also be assigned the correct name.
ex: Lead Name: Marc benioff could be converted into a Person account with the name of Marc benioff and Opp name of Marc benioff.
i came across "Mass Lead Converter by Force.com Labs" it has a limitation of 100 records for click i need to overcome this too..Any help greatly apreciated..
Try to create a Trigge to handle the same,the Trigger would run on update event of Lead.Please find below the code for your reference :-
trigger LeadConvert on Lead (after update) {
List<Account> accList = new List<Account>();
List<Contact> conList = new List<Contact>();
List<Opportunity> oppList = new List<Opportunity>();
//Bulkified
for (Lead lead : Trigger.new) {
if (lead.isConverted == false) //to prevent recursion
{
Database.LeadConvert lc = new Database.LeadConvert();
lc.setLeadId(lead.Id);
LeadStatus convertStatus = [SELECT Id, MasterLabel FROM LeadStatus WHERE IsConverted=true LIMIT 1];
lc.setConvertedStatus(convertStatus.MasterLabel);
Database.LeadConvertResult lcr = Database.convertLead(lc);
System.assert(lcr.isSuccess());
Account acc = new Account(id=lcr.AccountId,Roll_No__c=lead.Roll_No__c);
accList.add(acc);
Contact con = new Contact(id=lcr.ContactId,Roll_No__c=lead.Roll_No__c);
conList.add(con);
Opportunity opp = new Opportunity(id=lcr.OpportunityId,Roll_No__c=lead.Roll_No__c);
oppList.add(opp);
}
}
update accList;
update conList
update oppList;
}