Salesforce Web to Lead

Salesforce Web to Lead

What is Salesforce Web to Lead

Salesforce web to lead is used to capture the leads from your website and save in Salesforce. This is built in functionality in Salesforce.  A web-to-lead form is an essential component of marketing and sales automation. Its purpose is to capture data submitted by website visitors, such as contact information and product interest, and store it as a “Lead” record in  Salesforce.

How to setup web to lead Salesforce

  • Salesforce Classic : Go to Setup -> Customize -> Leads -> Web-to-lead
  • Salesforce lightning: Go to Setup -> Feature Settings -> Marketing -> Web-to LeadWeb To Lead Salesforce setup
  • Click on Create Web -to-Lead Form
  • Select the fields you want on the form, give the redirect URL,
  • Uncheck checkbox Include reCAPTCHA in HTML. Or if you want to enter recaptcha , enter the API Key Pair information. For more details please refer Salesforce Web to lead form with reCAPTCHA
  • Click on Generate
    Web To Lead Salesforce setup details
  • Following html code is generated
    <!--  ----------------------------------------------------------------------  -->
    <!--  NOTE: Please add the following <META> element to your page <HEAD>.      -->
    <!--  If necessary, please modify the charset parameter to specify the        -->
    <!--  character set of your HTML page.                                        -->
    <!--  ----------------------------------------------------------------------  -->
    <META HTTP-EQUIV="Content-type" CONTENT="text/html; charset=UTF-8">
    <!--  ----------------------------------------------------------------------  -->
    <!--  NOTE: Please add the following <FORM> element to your page.             -->
    <!--  ----------------------------------------------------------------------  -->
    <form action="" method="POST">
    <input type=hidden name="oid" value="00D1t000000sTJD">
    <input type=hidden name="retURL" value="">
    <!--  ----------------------------------------------------------------------  -->
    <!--  NOTE: These fields are optional debugging elements. Please uncomment    -->
    <!--  these lines if you wish to test in debug mode.                          -->
    <!--  <input type="hidden" name="debug" value=1>                              -->
    <!--  <input type="hidden" name="debugEmail"                                  -->
    <!--  value="">                                      -->
    <!--  ----------------------------------------------------------------------  -->
    <label for="first_name">First Name</label><input  id="first_name" maxlength="40" name="first_name" size="20" type="text" /><br>
    <label for="last_name">Last Name</label><input  id="last_name" maxlength="80" name="last_name" size="20" type="text" /><br>
    <label for="email">Email</label><input  id="email" maxlength="80" name="email" size="20" type="text" /><br>
    <label for="company">Company</label><input  id="company" maxlength="40" name="company" size="20" type="text" /><br>
    <label for="city">City</label><input  id="city" maxlength="40" name="city" size="20" type="text" /><br>
    <label for="state">State/Province</label><input  id="state" maxlength="20" name="state" size="20" type="text" /><br>
    <input type="submit" name="submit">
  • Copy and Paste the above HTML code in your website. In the generated code, you can edit the CSS as per requirement so that it should look as per the theme of website.
  • User will submit details from your website. Lead record will be created in salesforce.


Enable Web- to-lead

We have ‘Edit button’ with ‘Generate Web to lead button. We can use it enable web to lead. Here are some setting in this page

Web-to-Lead Enabled: Enable web to lead form in your org.

Require reCAPTCHA Verification : To reduce spam, require reCAPTCHA verification for customers’ requests. When enabled, requests without verification don’t generate leads. After enabling, confirm that your HTML includes the reCAPTCHA information.

Default Record Creator – The user who will be listed as Creator when a Lead is created online. In most cases this will be the Lead Record Owner, but if configured, Lead Auto-Assignment rules may change the ownership. Also this will be the User that will send out the Default email response template (see below) unless Auto-Response Rules are configured – keep reading!

Default Response Template –Use Lead Auto-Response Rules to select different email response templates based on attributes of the leads submitted online. Leads not matching any of the rules will be sent the default response template selected below.

For more details refer to salesforce web to lead official link

Permanent link to this article:


1 ping

Skip to comment form

  1. Trailblazer Community : How Can I Receive a Notification Email When a New Lead Comes In? Use a web landing page to capture visitor information, and receive real-time notifications when new leads come in.

  2. Since you will now be using the Web-to-Lead forms, you can also have hidden fields with prepopulated values in them, which define a lead source or campaign, or indicate which form on your web site(s) a lead submitted. Those values can be very useful in driving automated actions once the leads arrive in Salesforce. Create some email templates for autoresponders, and have tailored autoresponses sent to the leads depending on the values they have or how they are assigned when they come in. Branching out from the core Salesforce functionality, set up a tracking application that can provide additional information about where a lead came from. This is especially critical if you are spending money on Google Adwords or other online marketing, since you will want to know which advertising produced the best quality leads.

    • Dexter Louie Aniez on March 6, 2021 at 1:50 am
    • Reply

    How can I submit a lead from my external code to webtolead API using javascript?

    • Pratiksha on March 14, 2021 at 6:26 pm
    • Reply

    Your blogs are really helpful.
    Great work, keep helping!!

    • Lea on January 11, 2022 at 12:35 am
    • Reply

    We already have a lead form built on our website (it wasn’t created using Salesforce). Is there Salesforce tracking/code we can add to our existing lead form so that we don’t have to make a new one? If yes, will continuing to use the existing lead form with Salesforce tracking provide the same benefits as the Web-to-Lead form e.g. — automatic upload of leads to Salesforce, assigning opportunities to people, automated email functionality, etc. — or would we still need to create a new lead Salesforce web-to-lead form?

  1. […] a simple HTML markup which can be downloaded from SFDC instance. You will get this from SFDC team. Here is how to do it. – This is also unique for every salesforce instance. If you look at the […]

Leave a Reply

Your email address will not be published.