Integrated Communications

Salesforce Web-To-Lead Webform: Salesforce for the Masses

Dagoberto Aceves
Lead Engineer

Salesforce has poised itself to be the best Customer Relationship Managment (CRM) on the web. Having reached such a high point in the CRM market, Salesforce can demand a premium price for its API supported packages. This also means that Drupal's Salesforce Suite can't be used, but that doesn't mean you have to miss out completely. Salesforce Web 2 Lead Webform is a solution for people who want pick up Salesforce leads from their Drupal site without the price hike.

To be clear, the Salesforce API will allow for some elegant integration solutions far beyond this path. You can read about those possiblities in our Salesforce white paper. Salesforce Web 2 Lead is purely a lead collection device that will allow you to leverage new and existing webforms to funnel leads into your Salesforce account. This solution is limited but is a great alternative for 'good enough' instances.

How Salesforce Web 2 Lead Works

Salesforce Web 2 Lead takes advantage of one of the primary lead collection tools called "Web-To-Lead". It should be available to all Salesforce account types, and it is particularly important for account types that do not have access to the API. To avoid manually inputting lead information into your Salesforce account, this would be the best way to automate the lead gathering process on the web.

The Salesforce Web 2 Lead module connects the form generated from the Web-To-Lead tool to Drupal's popular Webform module. This module allows you to hook up preexisting webforms to the lead system so you don't need to rebuild; just install, perform some quick set up, and you're done. You are on your way to collecting leads with your existing webforms.


Installation is your typical Drupal install. Download, install, done.

Download the module and its dependencies starting from the project page. Then go to your sites module admin page and enable.
Project page:

Using Drush you can use the following commands:
drush pm-download sfweb2lead_webform
drush pm-enable -y sfweb2lead_webform

After installing, the setup is a bit different if you're starting a new webform or using an existing webform. Both setups will require for you to have created a Salesforce Web 2 Lead beforehand. We cover that in the Pre-Setup below.

Pre-Setup: Creating A Web-To-Lead Form On Salesforce

After logging into your Salesfoce account, head over to the Web-To-Lead page. You can get to this Salesforce feature by going to "Setup > Customize > Leads > Web-to-Lead" on your Salesforce account. This feature is a step-by-step wizard that lets you build choose fields from your Lead object for the information you want to gather. On the last page you'll get to a text area with the html output from the wizard. You'll want to save this html for the Drupal setup.

Setup: Starting With A New Webform

Starting from scratch makes life particularly painless. Using the HTML from the Web-To-Lead Form generated by Salesforce, you'll want to pick out the field names for the values you want to collect and create a new webform using these field names as your component names. Attached is an image below with sample HTML generated from Salesforce. The areas highlighted in green show the fields this form is collecting. Name your components the value that is between the double quotes. In this example we would create a new webform with the components named:

After creating your webform, you'll need to do one last step of updating the OID field setting.  You can find it on your Drupal admin pages under these paths:
D6: admin/settings/sfweb2lead
D7: admin/config/services/salesforce_webform

After setting the OID, the value highlighted in blue in the screenshot below, you should be ready to go. You are now ready to collect leads from your handy dandy webform. Cheers.

Setup: Hooking up a Preexisting Webform

Hooking up a preexisting webform requires a bit more legwork than starting from scratch. First, go to the edit page for the webform you want to hook up to Salesforce. You'll need to write down all the values for the components you are planning to send to Salesforce. You can only send over the fields that the Salesforce Web-To-Lead Form generated. Be sure to cross-reference with your Web-To-Lead Form HTML to make sure you get all the component names, otherwise you'll end up with some empty values in your leads.

You are really only looking for component names that don't match up with the value from the form HTML. What you are going to do is create a mapping for webform field components that don't match the fields Salesforce is expecting. For example, if your Salesforce Web-To-Lead Form HTML had the fields below

<input name="first_name" ... />
<input name="last_name" ... />

Salesforce is expecting to get the "first name" and a field called "first_name". If on your webform your component is called "first_name" then you are set, there is no need to create a mapping for it. However, if your webform has a different component name, "fname", "firstname", "firstn", etc., you'll want to write down that you need a mapping from "fname" to "first_name". This process can get tedious if you have a lot of fields. There's a tool in the works to make this step less painless but it has yet to make it to the wild.

If were looking to add more fields to your webform that you are collecting in your Lead, name the new webform components using the value from the HTML form. After you have completed adding your new fields to the webform and you have the components names, you need to create mappings. Head on over to the admin page to creat the mappings.  You can find it on your Drupal admin pages under these paths:

D6: admin/settings/sfweb2lead
D7: admin/config/services/salesforce_webform

Add the OID value to the admin settings. Next, add the field mappings for the components you need to map from your webform to your Salesforce Web-To-Lead form. Let's create a mapping using our example above where our Salesforce account was waiting for "first_name" and our component name was "fname". In this instance we would enter the value "fname" under the column "Webform Field Key", on the same row we would enter the value "first_name" under the "Salesforce Web-To-Lead Form Key". And you're done! You are ready to start collecting leads from your webforms. Hooray!


I hope you enjoyed this blog about how Drupal can integrate with Salesforce even at affordable account levels. If you do have an account with access to the Salesforce API, I would urge you to take a look at our Salesforce white paper. You get much more and when you're paying for a premium level, it makes sense to get the most of your investment. Happy Drupaling!


More about Integrated Communications

Achieve recently attended HCIC and gained some valuable insight. We have been attending HCIC for a number of years and have seen trends come and go. Ron Huber, the CEO of Achieve, shares his thoughts on what he learned and experienced at this year's conference.  
Digital Health Innovation SD Event on TeleHealth
TeleHealth: Today and Tomorrow Event Recap Digital Health Innovation San Diego has continued to grow as we further discussions in the community about some of the most pressing matters in the healthIT sector. To that point, our latest event was focused on TeleHealth and it’s growing impact on the healthcare industry.