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

Web2Lead avoid duplicate leads

We have a Web2Lead form, with many products. 

Leads use to fill in the form interested in one of the products “xx” , but it is pretty normal that a few days later they fill in the form interested in other product(s)


On the leads page, I do have a related list called "xx"


I have a trigger that creates a new "xx" for each product the lead has asked for


The issue is that the second time a lead fills the form, Salesforce creates a duplicate lead, and then I have to merge them…..


How can I create a trigger that will look at the lead email address and then if the lead already exists update only the empty fields and add a line item to the related list? avoiding duplicates?


Thank you


It sounds like you should use a Visual Force page on a public site for Web2Lead instead of the static HTML.  I say this because if you were using a VF page for Web2Lead, you could put this logic in the controller or controller extension. 


I think this kind of logic probably needs to be in the controller or controller extension instead of the trigger as it seems you only want to do this for records from Web2Lead and it would give you more SFDC type control in your form (i.e. validation, ajax, etc).


That being said, you could probably do this in a trigger.

David SomekhDavid Somekh

I understand your point.

I don't know exactly how the web2lead is been used here.

I certainly have to do some more research!



Thank you for getting back to me!!:)


I cannot create a site which is a good idea because leads come from many different pages,then are store in one platform and from there are entered in salesforce as the company does not want to change that and pay more services I have to do all the job once the lead enters in saleforce!


I think I have the way! will try to work on it and let you know the results!!:)