Web-to-lead is the easiest way how to generate leads from your web page into Salesforce CRM. Some users use web-to-lead as ‘Contact us’ form or require some steps before allowing content on the web page. When you have leads in your org, you can contact them and, hopefully, convert them into the contacts with created opportunities. However, this is on your decision.


To create web-to-lead form, go to Setup->Customize->Leads->Web-to-Lead. Allow this functionality if it is not enabled. Then you can click on the button to generate web-to-lead form. In the next step you can select fields which are important for you from a new lead. Also put return url – it’s URL where you want to redirect user after submitting the form. In general, it is a page where you can find the form or other pages with thanks. After generate form, put it into your web page and test it. After submitting form, lead will be created in your organization. Then it is again on your decision how to contact this new lead.


To the solution introduced above, there is one more issue to be discussed. If your page is frequently visited by spammer bots, which populate web forms with various kind of advertising, you will have many unusable leads. It can be issue with limits for how many leads you can create with web-to-lead daily (limit is 500 for 24 hours). For more infomation about limits for collecting leads read this topic https://help.salesforce.com/htviewhelpdoc?err=1&id=faq_leads.htm&siteLang=en_US

There are 3 options how to prevent this:

  1. Use captcha

Captcha is very popular for prevention of submitting forms by spam bots, but it’s not very favorite for users, because they must rewrite it. Sometimes they make mistake, and they must rewrite it again and again.

  1. Use fake field

This is a little trick. Almost all spam bots populate each field which we find in form. You can add one custom field, and check with formula validation if this field is populated via web-to-lead form. Do not forget to hide it via CSS and do not add this field into page layout, too. I recommend you use the field name URL (spam bots like this field name). In the formula validation, you can check if the lead is populated from web-to-lead URL field. If it’s empty that means everything processed.

  1. Use Javascript for populate org id

For this technique JAVA must be used. Only minimum spam bots can executes javascripts.  After you generate web-to-lead form, delete value of oid field from it (but remember it). Then create onclick javascript for submit button, which populate oid field before submitting. This javascript can be like this:

<script>document.getElementById(‘oid’).value = ’00Di00000012345′;</script>

When user clicks on submit, javascript will populate oid with the correct organization id and everything will work.

Article written by Maroš Sitko, Senior Developer