Salesforce have ‘lead’ as standard object which is one of the most used object over the salesforce , lead object is mostly used in product based application so consider you have your own website and you want to capture the leads directly from your website in that case you need to generate web to lead form and then fill the form in your website and then a lead would generate in the salesforce , so in this post I will talk about how to create web to lead form in just few clicks and how to hard code values in the web to lead form for some fields so let see how we can achieve this
How to create Web to Lead form
It is very easy to create web to lead form, we just need to search web-to-lead from the search box which appearing on the left hand side, see below picture for more details.
A new window would get open and in that window click on create web to lead form, see below picture for more details.
A new get opened in that window choose the fields that you want for your web page all the fields you want would go to the selected fields and in the below section you need to enter return URL this URL specify where to redirect user after filling the form, see below picture for more details.
After clicking the generate button you will see some code, we just need to copy that code and save that code as in HTML format, that’s it now you have created web-to-lead form successfully now let see how to hard code some values in the web to lead form, so whenever user filled form the default value would come in the record.
How to hard code values in Web to Lead form
Let assume you have pick list and you want to a particular default value to be entered in the record when ever record is created via filling the web to lead form so to do that we need to hard code values in it, see below pick list it contains many values but I only ‘Web’ value as default in the record.
So let’s create a web to lead form after creating a web-to-lead form it contains so many values, see below picture for more details.
so to set a default value as ‘Web’ delete all the values of that particular field and and change it with the with the input value see below picture .
As you can see in the above screen I am using the same ID=lead_source and same name=”lead_source” as in the standard web to lead form but one important change I did that I have taken value=”Web” so whenever someone filled form the lead source value would come as ‘Web’ by default.
So same as above we can also set default record type in the field using input field, See below syntax.
As you can see in the above screen id and name values have been taken from the standard web to lead form and value have been set by hard code so whenever someone filled the form it would go to the default record type ,if we want to create general syntax of it then it would be like.
<input id=”recordType” name=”recordType” type=”hidden” value=”01290000000iGiY”/>
id & name: Should be taken from the default web-to-lead form
<input id=”” name=”” type=”hidden” value=””/>
Value: Default value that you want to set.
That’s how we can easily create web-to-lead form in the salesforce and can also hard code values in the form so whenever someone filled the form it would come populated in the fields,I hope you like my this post if you have any query please do leave a comment below in the comment section.