You need to sign in to do that
Don't have an account?
Passing Custom Field Data from the Lead to the Contact on Convert
I am trying to get this trigger working where after I have converted a Lead to a contact, I want to save data from the Lead.Secondary_Email__c to the Contact.Secondary_Email__c.
I feel like I'm close but I can't get a contact from the Lead... Any help would be appreciated!
trigger onLeadConverts on Lead (before update){
for (Lead l: trigger.new){
if(l.isconverted==TRUE){
// l.ConvertedContactId;
// Contact c = new Contact(id = l.ConvertedContactId);
//Contact c = Contact(id = l.ConvertedContactId);
// l.ContactId is not recognized?? How do I get the ContactID from the Lead?
System.assert(l.ContactId);
Contact[] c = [select Id from Contact where Id = l.ContactId];
c.Secondary_Email__c = l.Secondary_Email__c;
}
}
}
Why doesn't it work just to setup a standard field mapping from the Lead object?
All Answers
Why doesn't it work just to setup a standard field mapping from the Lead object?
Thanks, I was able to get the trigger to work but a standard field mapping would be preferred because its less maintence. I'll try that!