Create Web to Lead form in Salesforce

Author posted by Jitendra on Posted on under category Categories Salesforce and tagged as Tags with 6 Comments on Create Web to Lead form in Salesforce

I decided to write this article because of lots of comments received from the newbies in Salesforce community. We know that the Lead is the pillar object in CRM from where everything is started. And every CRM related software tries their best to offer best and reusable feature to work with lead and same thing is with Salesforce also. In Salesforce you can create a lead by traditional way like logging into application and then performing other steps.

Web-to-Lead in Salesforce
Web-to-Lead in Salesforce

Salesforce also have lots of cool feature to make the life of marketing user easy and one of them is “Web to Lead”. It is possible for any organization that the lead (Potential customer) is coming from the site hosted for some product. So in that case we can host a web form (Simple HTML) on that website and whenever the form is filled its record automatically gets created in Salesforce.

So let’s start walkthrough for creation of “Web to Lead” form.
Navigate to “Settings | App Setup | Customize | Leads | Web-to-Lead”.
Now enable “Web to Lead” setting and assign “Default Lead Creator”, This user will be used to create the lead from Web to lead form.
We can also set the “Default Response Template”, in case we want to auto reply the submitter that his application is submitted successfully.

Web to lead Setting in Salesforce
Web to lead Setting in Salesforce

Then click on button “Create Web-to-Lead Form”.

Generate Web-to-Lead Wizard
Generate Web-to-Lead Wizard

After click on button, above wizard will open.
Here we can decide that which fields should be present in the form and in which sequence.
We can select the return URL (In most of the cases it would be the URL of site from which the form is invoked) also.
Now click on “Generate” button. The HTML code will be generated as per below image.

Web-to-Lead generated code
Web-to-Lead generated code

Copy and Paste the above code in HTML file and place the file as per requirement.
In the generated code, you can edit the CSS as per requirement so that it should look as per the theme of the parent side.

However, do not change the following component in code.

  • “action” url in form tag.
  • “method=post” in form tag.
  • Hidden field value of component name “oid” (This contains the Organization ID and from this only Salesforce comes to know that in which organization the Lead should be created).

Related posts

6 thoughts on “Create Web to Lead form in Salesforce”

  1. Dear jitendra,

    Kindly help me out for below issue.[WEB to LEAD]

    Salesforce could not create this lead because of the
    reason listed below. For more information about this error or help with
    Web-to-Case-Lead, please contact Customer Support.

    Reason: Lead Source should be as per the system values

  2. HI Jitendra, Can you guide me how do I create Web To Lead with Attachments. We have contact us page on website with Attachments and I want to have attachments added to Lead in salesforce.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.