Web-to-lead
A web-to-lead form is an essential component of marketing and sales automation. The aim is to capture data presented by website visitors, such as contact information and product interest, and store it as a “lead” record in a CRM product, in this case Salesforce.
The use cases are many, but the concept is similar. A visitor to your website is presenting contact information on your website and this submission creates a record as a lead in Salesforce. It is a way to get feedback on your product and services or to grow your marketing database.
Steps to Create Web-to-lead
Go to Setup -> Search for Lead -> Click web-to-Lead -> then click Create Web-to-Lead form
Select fields and Enter Return URL. If you want Captcha Enable “Include reCAPTCHA Key Pair” otherwise deselect it.
For reCAPTCHA you need to go to this link
https://developers.google.com/recaptcha/docs/settings
By logging into your Gmail account you can create key value pairs for reCAPTCHA
Here, I am not including recaptcha.
This is the complete code:
Create this form in Your PC and save it in .html format.
<!-- ---------------------------------------------------------------------- --> <!-- 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="https://webto.salesforce.com/servlet/servlet.WebToLead?encoding=UTF-8" method="POST"> //Here Oid is Organization Id or org id, To Navigate Go to Setup > Administration Setup > Company Profile > Company Information – you’ll see your OID listed as a field on that page as well. <input type=hidden name="oid" value="00D7F000003ggss"> <input type=hidden name="retURL" value="http://www.google.com"> //If the debug value is set to “1” you will see a confirmation after you submit your lead like the one below. You will want to remove this once you go live – it’s just for testing. <!-- ---------------------------------------------------------------------- --> <!-- 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="[email protected]"> --> <!-- ---------------------------------------------------------------------- --> <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"> </form>
Here you can find the Lead in Salesforce after submission of Lead.
Also Read: How To Do Component Communication In LWC In Salesforce
If Added reCaptcha
You will find this form
Web-to-case
Web to Case is a tool through which you can post a simple, random web page that allows your customers. To submit a case directly to your Salesforce.com instance. This means that you can present a public case
Page on your website with your own branding and style.
When your customer posts a case via Web to Case, a few fields are generally required, most importantly the name and the email address.
Prerequisites for Web-to-case are
- 1. Create a custom case field if necessary.
- 2. To create a default email template for automatic notification that will be sent to your customers upon submission matter.
- 3. Cases Create case queues if you want to assign incoming cases to queues as well as individual users.
- 4. The Customize support settings to select the default owner of cases that do not meet the criteria in your assignment Rule.
- 5. Generated Create an active case assignment rule to ensure how web-generated cases are assigned to or inserted into users
- 6. Queues. If you do not set an active assignment rule, all web-generated cases are assigned to the default owner
- 7. You specify in the support settings.
For Web-to-case Settings
Go to Setup -> Quick Find Box -> web-to-case
Here you can require the Captcha, you can Select Case Origin from Phone, Email or Web.
To create Web-to-case html form
Go to Setup -> Self-Service or Search for Web-to-Case-HTML-Generator -> Then to create form Select Fields for Case -> Return Url -> reCAPTCHA Key Pair if needed.
Then Click on Generate. It will Generate this form:
<!-- ---------------------------------------------------------------------- --> <!-- 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="https://webto.salesforce.com/servlet/servlet.WebToCase?encoding=UTF-8" method="POST"> <input type=hidden name="orgid" value="00D7F000003ggss"> <input type=hidden name="retURL" value="http://www.google.com"> <!-- ---------------------------------------------------------------------- --> <!-- 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="[email protected]"> --> <!-- ---------------------------------------------------------------------- --> <label for="name">Contact Name</label><input id="name" maxlength="80" name="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="phone">Phone</label><input id="phone" maxlength="40" name="phone" size="20" type="text" /><br> <label for="subject">Subject</label><input id="subject" maxlength="80" name="subject" size="20" type="text" /><br> <label for="description">Description</label><textarea name="description"></textarea><br> <input type="submit" name="submit"> </form>
Here is the case, created from Web
If you ever require assistance for a complicated project based on salesforce then our team of professional and adroit salesforce consultants and developers will be perfect. We have been providing salesforce development services to clients all over the world for a long time and have been able to help them achieve their goals.
Also Read:
How To Create A Custom Report Type In Salesforce and How To Use Database.Stateful In Batch Apex In Salesforce