You need to sign in to do that
Don't have an account?
mattdarnold
Inserting new lead with campaign
Hi all,
I am trying to write a bit of Apex code to check for duplicate Leads before insert. These would be Leads coming from a web-to-lead form and they would be associated with Campaigns.
If it does find a duplicate, it should do the following:
1. Shouldn't insert this lead
2. Should take the existing Lead and create a CampaignMember record that links the existing Lead with the Campaign ID associated with the incoming Lead.
The trouble I am having is that I don't really understand how the web-to-lead form inserts records into the database and how I could access the associated Campaign and ID through the trigger. Any help is greatly appreciated.
Thanks,
-- Matt
I am trying to write a bit of Apex code to check for duplicate Leads before insert. These would be Leads coming from a web-to-lead form and they would be associated with Campaigns.
If it does find a duplicate, it should do the following:
1. Shouldn't insert this lead
2. Should take the existing Lead and create a CampaignMember record that links the existing Lead with the Campaign ID associated with the incoming Lead.
The trouble I am having is that I don't really understand how the web-to-lead form inserts records into the database and how I could access the associated Campaign and ID through the trigger. Any help is greatly appreciated.
Thanks,
-- Matt
Phil_R
Hi Matt,
You would need to run a couple of queries that searches both the leads as well as the campaign members.
You'll need to also consider a number of scenarios such as (more than one record found, none found).
If you have any further questions feel free to contact me on philipp.rackwitz at sofiaworks.com
Best,
Phil