I have created custom name, email, phone fields on lead apart from standard name email and phone fields. I want, when lead qualified and converted so it should be created as new contact under the same company name. How can I achieve this?
Please find below trigger:
trigger LeadConvert on Lead (after update) {
map<Id, Lead> mapNewLead = trigger.newMap;
List<Contact> lstContact = new List<Contact>();
for(Lead objLead: mapNewLead.values())
{
if (objLead.isConverted == true)
{
lstContact.add(new contact(LastName = objLead.First_Other_Contact_Name__c));
lstContact.add(new contact(Phone = objLead.First_Other_Contact_Phone__c));
lstContact.add(new contact(Email = objLead.First_Other_Contact_Email__c));
}
}
insert lstContact;
}