+ Start a Discussion
dmotedmote 

Custom Lead Object Mapping on Lead Conversion

I have created a custom object attached to a lead, called a lead remark.  I also have an object called remark attached to contact.  Is it possible to map all of the lead remarks to move to contact remarks during the lead conversion process?

 

Thanks in advance!

David

Message Edited by dmote on 11-10-2009 11:14 AM
Best Answer chosen by Admin (Salesforce Developers) 
jkucerajkucera

Sample Syntax:

 

trigger test on Lead (after update) { for(Lead lead:System.Trigger.new) { if (Lead.IsConverted) //Query for CustomObjects Desired //Set CustomObject.ContactID__c to Lead.ConvertedContactID }//if }//for //trigger

 

All Answers

sfdcfoxsfdcfox
You can do so using a lead trigger. I believe you would do so immediately after the lead has been converted (trigger on after update). I'd have to test this, although I recall having this problem before and working around it using an after-update trigger (this ensures that the contact/account/opportunity has an ID that you can use to reference). The Lead.Converted*ID fields contain the values that you should use.
jkucerajkucera

Sample Syntax:

 

trigger test on Lead (after update) { for(Lead lead:System.Trigger.new) { if (Lead.IsConverted) //Query for CustomObjects Desired //Set CustomObject.ContactID__c to Lead.ConvertedContactID }//if }//for //trigger

 

This was selected as the best answer