I am using web to lead form to enter data on a form externally. Whenever the form i submitted, leads are created in salesforce.

Now, i want to have a check for duplicates based on some fields, say first name and last name.

When the form is submitted with duplicate first name and last name, i want to show error message on the form saying that the lead exists in system.

Can you please guide me on how we can achieve this? Can we show real time error messages on web to lead form?

Thank you.

2 Answers 2


The Web-to-Lead form is actually not directly connected to your org. Instead, the Web-to-Lead form submits the data into a queue via the POST'ed form, and it is asynchronously sent to your org at a later point in time. Using this design, salesforce.com can continue to capture leads for your site even during maintenance, so that you don't miss any leads whenever there's a service interruption, outage, or scheduled downtime. When the queue is empty, the leads appear in your org within seconds, but during outages or peak usage, the delivery may take longer--either way, the form doesn't communicate anything useful back to the calling website, can't display errors, or do anything directly related to your org's records. As far as your leads are concerned, the service is always available to capture their information.


The form is submitted via an ajax call to Salesforce through the Server that hosts the web page your form is located at (it could be on any website). As such, the form doesn't "talk" to the Salesforce database directly. Instead, the data from the form is sent via https/REST to Salesforce from the web site's server. Salesforce then sends it to your Salesforce Org instance where the data is received and processed according to the rules you've configured for Web-To-Lead.

There is no "callback" function that would allow you to send a message back to your form. That would require a custom integration to have your form do validation with your database. All you really need do is to make certain you're removing duplicate leads according to the rules you set up when you configure Web-To-Lead.

You can do other real time validation of fields using JavaScript to validate your form prior to allowing someone to submit the form. You can also do RECAPTCHA integration to validate it's a person and not a bot that's completing the form.

However, connecting to your database for validation isn't a trivial task supported via Web-To-Lead functionality. You'd need a secure REST integration from your web site with Salesforce to query the form's input data to your Lead database, search for matches and compare results returning a true or false, as a validation before allowing the form to submit data to the web site's server (for the send to Salesforce) in order to create the functionality you ask about.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .