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
System Integration 35System Integration 35 

Apex trigger for Lead to Contact

I'm trying to update a custom field (Conversion_Type) from Lead to Contact, any ideas why it's not updating?
 
trigger LeadConvType on Lead (after insert) {     Map<Id,String> Conversion_Type = new Map<Id,String>(); // Map of the converted Contact ID and the Lead Status     for(Lead lead : Trigger.new) {         if (lead.IsConverted) {             Conversion_Type.put(lead.ConvertedContactId,lead.Conversion_Type__c);         }     }     List<Contact> conContacts = [select Id from Contact WHERE Contact.Id IN :Conversion_Type.keySet()];     for (Contact c : conContacts) {         c.Conversion_Type__c = Conversion_Type.get(c.Id);     }     update conContacts; }

 
Best Answer chosen by System Integration 35
sandeep@Salesforcesandeep@Salesforce
Hi , 
You are doing one mistake here. Your Trigger Events should be "After Update" instead of "After Insert".
If it was helpful, Please mark this as Best Answer so that it may help others as well. 

Thanks,
Sandeep Singhal
http://www.codespokes.com/

All Answers

sandeep@Salesforcesandeep@Salesforce
Hi , 
You are doing one mistake here. Your Trigger Events should be "After Update" instead of "After Insert".
If it was helpful, Please mark this as Best Answer so that it may help others as well. 

Thanks,
Sandeep Singhal
http://www.codespokes.com/
This was selected as the best answer
System Integration 35System Integration 35
Thanks