Admins

A Step-by-Step Guide to Creating Web-to-Lead Forms in Salesforce

By Mariel Domingo

Businesses these days are becoming more competitive, and staying ahead means being open to new opportunities. In the modern sales ecosystem, it’s important to capture leads from multiple channels (it could be your main website, social media, or digital ads) to ensure no potential prospect is overlooked or missed.

The main challenge, though, is effectively managing them as they flow in from various touchpoints. That’s where Salesforce Web-to-Lead comes in. This feature lets you automatically capture lead details submitted through a form on your website and then create corresponding records in Salesforce – yes, no manual data entry needed!

In this article, we’ll walk you through how to set up a Web-to-Lead form, along with some limits and considerations to help your business get the most out of this tool.

What Is Web-to-Lead?

Web-to-Lead is an out-of-the-box Salesforce feature that allows businesses to automatically capture lead information directly from their website into Salesforce. By creating a Web-to-Lead form, you can generate leads without manual entry, saving sales agents’ time and reducing the risk of errors.

This feature is useful for companies that have high website traffic and want to automate their lead-capture process. When a visitor submits a form on your website, a lead record is automatically created in Salesforce, which can then be used by your sales team to follow up on.

It’s pretty much the same as Web-to-Case, but this time, it’s for leads.

READ MORE: How to Create a Web-to-Case Form in Salesforce: A Step-by-Step Guide

Benefits of Using Web-to-Lead

  • Automated Lead Creation: This makes the sales process easier and more efficient by capturing leads directly from the business website.
  • Efficient Lead Management: Leads are instantly created in Salesforce so that sales teams can easily follow up on the customer’s interest.
  • Customizable Forms: You can tailor the form fields to capture relevant information, improving not only data quality but also customer experience.
  • Automated Response: Send auto-reply emails to acknowledge receipt and provide reassurance to customers.

Prerequisites for Web-to-Lead

Before you start, ensure that you meet the following prerequisites:

  • Admin Access
  • Lead Fields: List the lead fields that you’d like to be included in your form.
  • Email Templates: Prepare auto-response email templates for acknowledging the prospect’s interest.
  • Public Site Access: The form needs to be hosted on a publicly accessible website.
  • Lead Queue: If you’d like the web-generated lead to be owned by a queue, make sure to create it first. If not, you can set it up to be assigned to individual users instead.
  • Lead Assignment Rule: Decides how the web-generated leads are assigned to users or added to the queue you created. If you have no active lead assignment rule, the web-generated leads are automatically assigned to the default owner you specify in Setup > Lead Settings > Default Lead Owner.

Creating the Web-to-Lead Form

  1. In Setup, search “Web-to-Lead” in the quick find box. Select it to open the Web-to-Lead settings.
  2. Tick the box to enable Web-to-Lead.
  1. Also, tick the box for “Require reCAPTCHA Verification”. This is recommended to reduce spam, as requests that don’t pass verification will not generate leads.
  2. For the Default Lead Creator, select the user you’d like to appear as the person who created the web-generated leads. Note that this person should most likely be an admin, as they should have both the Modify All Data and Send Email permissions. If you’re just about to grant these to a user, both permissions must be granted either via a permission set or directly on the user’s profile. Don’t use a combination of a permission set and a user profile to grant these permissions.
  3. Select an email template as your Default Response Template. If you already have Lead auto-response rules set up in your org, the emails sent to prospects depend on the criteria you set. If the incoming lead does not match any of the criteria, the prospect will be sent the Default Response Template.
  4. Hit “Save”! You’re halfway there – all we need to do now is generate the HTML to be used on your website.
  5. Click “Create Web-to-Lead Form” from the same page.
  1. Remember the list of lead fields you wanted to include in the form? It’s time to pick them out by adding them to the Selected Fields column. Highlight the field you want to add and click the right arrow to transfer it.
  1. For the Return URL, enter the complete URL of the webpage where you want your customers to be directed after submitting the form. The URL could lead to a ‘thank you’ or confirmation page or simply your company’s homepage.
  2. If you selected “Require ReCAPTCHA Verification” earlier in the Web-to-Lead settings, complete the reCAPTCHA key pair. This setting is automatically selected and is read-only when Require reCAPTCHA Verification is enabled. You will need two things for this: the Site Key and the Secret Key. The Site Key is used to render the reCAPTCHA challenge on your website or application, while the Secret Key is used by your server to verify the user’s response to the reCAPTCHA challenge. You can obtain a reCAPTCHA key pair by signing up for an account on the Google reCAPTCHA Admin Console, along with instructions here. If you want to allow all traffic in the event that the Google reCAPTCHA servers aren’t available, select “Enable server fallback”. (Note: Skip this step if you did not select “Require reCAPTCHA Verification” in Web-to-Lead settings earlier.)
  3. Click “Generate”.
  4. Your sample HTML should be ready now.
  1. To test it, look through the code and find the word “debug”. You can do so by using Find in your browser or Ctrl + F on your keyboard.
  2. This part should get highlighted when found:
  1. See that each line starts with “<!–” and ends with “–>”. It means that these parts of the code are disregarded when run, and they’re considered as comments. Uncomment these three lines in your code by removing the “<!–” and “–>” from the beginning and end of each line.
  1. Copy the code and paste it onto the notepad. Save it as a .html file and open the file with your web browser. Here’s how the form should look in its simplest version:
  1. You can tweak the HTML code a little bit to get some customizations in and have it fit the aesthetic of your website. But for testing, I’m keeping it as is. Now, fill out the fields and click “Submit”.
  1. Debug should show you the right information according to your org and the details you enter into the form.
  2. If you’d like to see the form in action, go back into your code and re-comment the debug lines from earlier. Save the file again, then open it with your browser and fill out the fields again. Make sure to indicate that this is a test lead so your sales agents don’t mistakenly handle it!
  1. Click “Submit”, and you should be redirected to the URL we set up as the Return URL.
  2. Check your org’s leads. If you sort from latest to oldest, the created lead should be first on the list.
  1. Open it and verify if the fields have been populated accurately. You should see that the auto-response email has been sent to the customer as well.

Considerations for Using Web-to-Lead

Web-to-Lead is great, but just like Web-to-Case, it has its limits too, like the lack of support for files and attachments. Leads that are generated from your website will be initially marked with the default status specified by the Lead Status picklist.

If you think the 5,000 case limit for Web-to-Case is too little, then wait ‘til you hear the limit for Web-to-Lead! The limit is just 500 leads within a 24-hour period. When that 24-hour limit is reached, and more than 500 leads are submitted within that time frame, the excess requests are stored in a pending request queue that contains both Web-to-Case and Web-to-Lead requests. Those requests are submitted when the limit refreshes and are counted against the next day’s limit.

When you enable Web-to-Lead, spam will most likely be an enemy. reCAPTCHA is your first line of defense, so if you haven’t used it with Web-to-Lead or Web-to-Case yet, consider doing so!

If you have duplicate rules set up in your org, you could potentially get errors with Web-to-Lead enabled. So if you have a duplicate matching rule that is set up to block, or to allow with an alert, Web-to-Lead submissions that match the duplicate rule will always be blocked. To allow leads like this to be created, consider adding a condition on the existing Duplicate Rule so that it does not run when the current user is the default Web-to-Lead creator that you set.

Summary

Web-to-Lead is a great tool for automating lead capture directly from your website into Salesforce. It’s easy to streamline your lead generation process and boost your business’s sales efforts if you know how to utilize this feature. By following the step-by-step guide above, you can quickly set up your own Web-to-Lead form and start capturing valuable leads for your sales team to follow up on.

Have you set up Web-to-Lead in your org yet? What were the challenges in doing so? Leave them in the comments below!

The Author

Mariel Domingo

Mariel is the Courses Administrator at Salesforce Ben.

Comments:

    Daryl Moon
    April 16, 2025 9:26 pm
    Submit your generated html code to ChatGPT and ask it to add some styling to it to make it look pretty. You will be pleasantly surprised by the results.

Leave a Reply