+ Start a Discussion

Pulling a matching account and lead and link the two after insert.

I have will have leads coming into the object from an external system.  It will include an external record number.  If the lead gets converted but it does not sell the opportunity it will stay in the lead pool on the external database.  This means at some point after that it may come back into the Leads object with the same external record ID.  I need an apex trigger to search the account records after the lead is inserted and find any matches for this unique external record identifier.  If found take the SF record ID for that matching account and insert it into the matching Lead record custom lookup field to the account.


Anyone have a good place to point me to get me started?  Sound like it should be simple but I'm just starting on Apex code and its been years since I did any programming back in college.