Add a Field to Salesforce.com Web-to-Lead form

I often have to modify a site that uses Salesforce.com for their form handling, and it can be quite a lot to keep in one’s head sometimes. It also is difficult to explain to someone else in a mail or over the phone when you need them to do something for you, so I am going to start posting here each explanation I give out. One day maybe I will have a simple guide to the basics of Salesforce.com

Today’s task is to add a couple of fields on a form, as well as adding these to the salesforce database and confirmation emails etc. Here we go.

login to salesforce.com
choose setup (upper right corner)

first step is to add the new fields to the database, adding a check box for Mon and Tues in this case, and I use a special prefix and name scheme for fields I create, so these will look like MyPrefix_AvailableMon and MyPrefix_AvailableTues. Note the actual prefix is different in my case, and should be as the others are, which will be obvious when looking at them

under app setup (on left side) open Leads
choose fields
scroll down to “Lead Custom Fields & Relationships”
choose New
choose type (checkbox in the case of the days of the week to add)
choose next
enter a label and name (MyPrefix_AvailableMon/MyPrefix_AvailableMon and MyPrefix_AvailableTues/MyPrefix_AvailableTues in our ccase)
choose next, then next again, to complete, accepting the defaults
choose save, or if making more “save and new”

Next we will get the HTML for the new controls to add to the TFK site

under App Setup again, on the left, under leads, choose web-to-lead
choose the button in the middle of the screen “create Web-to-lead”

hi-light any fields in the box “Selected Fields” and use the arrow to the left of the box to move them out of selected and back to “available fields”

Next scroll down in the available fields and choose your new fields, hi-light them then use the arrow button to the right to move your new fields to the “selected fields” box

then choose the “generate” button in the middle of the page, below the two boxes you have been working in

Scroll down and copy only the HTML elements for the two new fields you created. In our case these look like this:

MyPrefix_AvailableMon:<input id="00N50000001yAWZ" name="00N50000001yAWZ" type="checkbox" value="1" /><br>

MyPrefix_AvailableTues:<input id="00N50000001yAWa" name="00N50000001yAWa" type="checkbox" value="1" /><br>

and save this text, you will need to add it to the form on the site with the forms later.

next we need to add the new fields to the mails that come to us and the confirmation mails that go to the person that filled in the form

on the bar on the left, under “Personal Setup” choose “My Templates”

choose edit next to the email template that you wish to add the field to. These are related to the page you wanted to add the field to. There are two templates for each page, one for the mail to us, with all the data, and one that is a confirmation to the person filling in the form. In this case it is for a “volunteer signup” to choose now.

Choose “edit”, next to the signup page template

You will see a somewhat cryptic way they add the fields to the form, for instance the other days of the week are show like:

Wed: {!Lead.MyPrefix_AvailableWed__c}

so there is this !lead. before our field name. and the __c afterward. We can just copy this for our purpose of adding just a couple new fields, and these end up like:

Mon: {!Lead.MyPrefix_AvailableMon__c}
Tues: {!Lead.MyPrefix_AvailableTues__c}

choose save

Then choose edit next to the confirmation page for the signup page, and add the same fields to that page as you did above.

That is all for salesforce.com. Next edit the HTML form on your site that submits to the Salesforce.com web-to-lead page and add the two fields you saved a while back

These as you will recall looked like:

MyPrefix_AvailableMon:<input id="00N50000001yAWZ" name="00N50000001yAWZ" type="checkbox" value="1" /><br>

MyPrefix_AvailableTues:<input id="00N50000001yAWa" name="00N50000001yAWa" type="checkbox" value="1" /><br>

but you might want to change the label, add styles etc. to match the page, so just remember to keep the id and name as you have got from the web-to-lead generation page.

About these ads

About Jayson
Father, mountain biker, Software developer at a wire service, and also work with the IPTC (iptc.org)

One Response to Add a Field to Salesforce.com Web-to-Lead form

  1. Lauren says:

    Very helpful!!! Thank you!!!

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: