Introduction
Importance of Auto-Associating Leads
Marketing campaigns are a way to generate leads. Some methods might bring in more leads, while others might produce leads with higher potential.
In Salesforce, it's important to link campaigns with leads to understand their performance. This helps you track metrics that allow your organization to prioritize the campaigns that generate more Leads or revenue.
To link leads with campaigns, a Salesforce user with marketing permissions can easily add Lead Campaign Members to a Campaign.
But what if you want a new lead to be automatically linked to a campaign? For example, at an exhibition, you might want any lead from the event to be connected to the exhibition campaign.
Typically, at an exhibition, a salesperson would gather lead information by filling out a form, whether it's paper-based or a web form. In this case, a Web-to-Lead form is a good solution because the form submission will directly save the lead in Salesforce without any additional manual entry.
Overview of Web-to-Lead
Web-to-Lead is an out-of-the-box feature from Salesforce that allows an organization to generate HTML, usually for embedding on a company's website. Visitors can fill out the form to submit their information.
Web-to-Lead
Generate HTML
In Setup, type 'Web-to-Lead' and click the result under Marketing.
While in the Web-to-Lead Setup, click 'Create Web-to-Lead Form' button.
Select the Lead fields that you want to include on the form.
Click 'Generate' button. You'll be redirected to another page, copy the HTML snippet inside the box.
Paste it in any text or code editor and save it as HTML.
Now you have a working Web-to-Lead form.
Sample HTML
<!-- ---------------------------------------------------------------------- -->
<!-- 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&orgId=replace_this_with_you_org_id" method="POST">
<input type=hidden name="oid" value="replace this with you org id">
<input type=hidden name="retURL" value="http://">
<!-- ---------------------------------------------------------------------- -->
<!-- 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="jezkie.vn@gmail.com"> -->
<!-- ---------------------------------------------------------------------- -->
<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>
Associate Campaign
To associate a Lead submitted using our HTML or web form above, we need to make a minor change.
Inside the form tag, you'll notice 2 pre-existing hidden fields, one for organization Id and another one for return URL.
- Add the following hidden input fields under the 2 pre-existing hidden fields.
<input type="hidden" name="Campaign_ID" value="replace with actual campaign id" />
<input type="hidden" name="member_status" value="replace with valid member status" />
Replace
Campaign_ID
value with an actual ID of a campaign in your org.Replace
member_status
with a valid Campaign MemberStatus
.
That's it! Lead will now be automatically added as a Campaign Member every time a Lead is submitted through this Web-to-Lead form.