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.
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.
Then click on button “Create Web-to-Lead Form”.
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.
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).