Backing Up Your Data

Salesforce is so reliable and available, it is easy to forget to back up your data locally. Lately, I’ve was reminded that it is a good idea to back up your Salesforce data from time to time. Salesforce allows administrators to download a complete export up to once a week.

It isn’t that you have to fear for the Salesforce database crashing or being lost. I recommend downloading for a couple reasons:

  • It could help if you ever accidentally make unintended changes to data and want to return to an earlier state.
  • It could also be helpful in the event that Salesforce or your internet access ever goes “down” at a critical time – you’d have a way to access your data offline.

To download the backup, go to Setup (Administration) | Data Management | Data Export. Click the button – a while later you’ll get an email with a link to download your data file. Save it somewhere safe.

Alternatively, if you use Demand Tools, you can back up to a file as often as you like. I use this to create a copy of the database in a Microsoft Access file.

Web to lead: Javascript phone formatting

In a previous post, I talked about a few ways that I customize web-to-lead forms. One of the most important improvements you can make, I think, is to add Javascript functions to format phone numbers.

When you enter 10 digits into a phone number field in Salesforce, it gets formatted as (206) 555-1212. Web to lead forms don’t do this by default, so phone numbers show up in Salesforce with inconsistent formatting. This is the reason I first started fiddling with Javascript in web-to-lead forms.

Javascript lets you change data when a website user moves out of a field - you simply respond to the onblur event by calling a function such as my formatPhone function. In the web to lead form, your phone field tag will look like this:

<input  id="phone" maxlength="40" name="phone" size="20" type="text"
     onblur="formatPhone(this);" />

The Javascript code goes in a <script> block within the <head> section of the web page:

<script language="JavaScript" type="text/JavaScript">
<!--
    //Written by Evan Callahan, NPower Seattle
    function formatPhone(num) {
    var re= /\D/;
    var newNum=num.value;
     if (newNum != "") {
        while (re.test(newNum)) {
         newNum = newNum.replace(re,"");
        }
        if (newNum.length == 7){
           newNum = '(206) ' + newNum.substring(0,3) + '-' +
               newNum.substring(3,7);
           num.value = newNum;
        }
        if (newNum.length == 10){
           newNum = '(' + newNum.substring(0,3) + ') ' +
               newNum.substring(3,6) + '-' +
               newNum.substring(6,10);
           num.value = newNum;
        }
      }
    }
//-->
</script>

My function defaults 7 digit numbers to a 206 area code - if you aren’t fortunate enough to live in Seattle, you can replace this with a different default (or skip the whole section).

Ideas for better Web to Lead forms

We use web-to-lead forms pretty extensively for our Salesforce clients, because it is so much less expensive for them than integrating with the API.  We’ve found that WTL can work not just for ordinary leads, but also for simple event registration, volunteer signup, pledges, and many types of "applications" for service or grants.  Leads don’t have to be just people - they can bring in organization, donation, grant, or service information as well.

For example, we worked with a group that matches teen interns to other nonprofits that need interns.  The organizations that want interns apply for services on a web-to-lead form; the teen applicants sign up on another.  The first type of lead gets converted into an account, a contacts, and an internship "opportunity," while the intern applicants stay as leads until they are either matched to an internship (via contact roles) or rejected and deleted.

This is just one example of how web-to-lead has allowed us to set up simple website integration relatively quickly.

The more you use web-to-lead, however, the less you’ll like the HTML form that Salesforce provides you.  We edit the form pretty extensively, for several reasons:

  • To arrange and align form fields in a table and apply styles
  • To format phone numbers and other values as they are entered
  • To provide validation, making certain fields required and helping to avoid spam
  • To set hidden values, such as Lead Source or Record Type, that we don’t want to show on the form
  • To create or modify a picklist for values, such as Campaign

The first thing I do for web to lead is format the form in a table - two columns, with the labels at left and the fields at right. Then I add styles for labels and fields to the stylesheet.  For examples, take a look at forms for Teens in Public Service, Communities Connect Network, and Arts Corps.  To see the form’s HTML, view the source code for the page and search for WebToLead.

I will offer other a few other examples of web-to-lead techniques in subsequent posts.