Web to Lead

Salesforce allows you to generate a simple HTML form which you can add to your own website, to let prospective customers complete the form and be automatically entered into your Salesforce database as a lead.

These Salesforce fields can be used, and should be entered into HTML input fields in lower case with underscores as their input name.

  <input type="hidden" id="country" name="country" value="Australia">
<input type="hidden" id="state" name="state" value="WA">

If your form receives a submission with the same email address then you will receive this error as by default Salesforce rejects submissions with duplicate emails:

"Salesforce could not create this lead because of the reason listed below. For more information about this error or help with Web-to-Lead, please contact Customer Support. Reason: Use one of these records?"

For testing you may wish to use Gmail's task-specific address feature to create more email addresses.

For debugging purposes you can add the following hidden fields to the form:

<input type="hidden" name="debug" value=1>

debug set to the value of 1 will show a summary of the submission that Salesforce received, usually saying that Salesforce has queued the submission (for delivery shortly)

<input type="hidden" name="debugEmail" value="support@bigdatadigital.com.au">

debugEmail will email a summary of the submission that Salesforce received, with a link to the lead in Salesforce if it was successful. Note that debugEmail will only work if debug is also set to 1.

Web to Lead and Spam

Unfortunately a Salesforce Web to Lead form can attract a lot of spammers filing in your form. One way to avoid this spam is to add a CAPTCHA such as Google's reCAPTCHA to your Web to Lead form so that spammers can't use bots to complete these forms.

However since CAPTCHA's require server side confirmation that the user has completed the CAPTCHA then you will need to make your web form submit to a server side page, say in PHP, to validate the CAPTCHA, and then use the server side code to make your HTTP POST submission to the Salesforce server, say using cUrl.

Alternatively Salesforce allows you to generate a Web to Lead form with an embedded reCAPTCHA.

Copyright © 2023 Industrial Hypertext - Software Development Perth, Western Australia | All rights reserved
Contact Us today for an obligation-free meeting to discuss how we can develop an app, website, database, or other kinds of custom software for your business.
Contact: info@industrialhypertext.com