(Advanced) Pass values into a form via email

In this article:


Introduction

IMPORTANT NOTE: The instructions laid out in this article require extra care and precision in order to work correctly. 

In development circles, we frequently hear about the importance of creating personal relationships with your donors. So, when you ask a loyal supporter to fill out a form, wouldn’t it be nice to show them that you already know certain things about them, such as their name, email address, and so on?

This form, for example, loads with contact information fields pre-populated, based on the constituent's record in Little Green Light:

This article describes how you can send people to a pre-populated form like what's shown in the screenshot above using an email sent from Little Green Light (using LGL Direct Email). 

Please read through the prerequisites and caveats listed below before you get started.

Prerequisites:

Caveats to keep in mind:  

  • This approach only works when you are sending people to forms that are hosted by LGL Forms. (NOTE: All forms are automatically hosted by LGL, but if you publish a form directly on a webpage, such as on your website, it won't be possible for the fields to be pre-populated using the method described in this article). In other words, this process will not work if you attempt to pre-populate forms that are embedded in your website
  • The presence of certain characters in the data (most notably, the "#" character) will cause issues if you try to pass them through to a form, so it's important to avoid using special characters
  • Constituents’ best email, phone, and address information will be passed through even if they are marked as “inactive” in your LGL account.

Set up your form

In LGL Forms, create the form that you’ll be sending people to. If it’s a contact update form, you’ll likely use the standard fields for Name, Email, Phone, and Address, and Constituent ID (this last field will need to be hidden in the form). You can also add other fields, such as Spouse Name, and you may want to add an option for the respondent to tell you their communication preferences.

For help creating a form, see this this Knowledge Base article.

Map your LGL form to your Little Green Light account

We’d be remiss if we didn’t talk a little bit about how the completed forms are going to come back into your Little Green Light account; after all, that’s the whole point of sending out the form, right?

For more information on mapping LGL forms to Little Green Light, read about passing LGL forms data to your Little Green Light account.

Key things to know:
  • You'll pass the constituent_id into a hidden field in your form and use that to match back to the correct constituent record. This is described in the section below. If you skip this step, then in your matching preferences you will want to allow name-only matching. Otherwise, anyone who changed their email address will fail to match when the form is re-submitted (it is possible to manually match it up during review, and if you're relying on this you should also leave the “Require review before saving” default setting checked on your form's mapping page. This setting sends all of your form submissions into your LGL Forms Submission Queue, where you can review them before saving them into LGL)
  • In your form's mapping, it would be wise to add a default (which you can do by clicking “Add default” in the mapping) to set the incoming contact information as “preferred”. Because LGL allows multiple email addresses, phone numbers, and physical mailing addresses, these incoming bits of contact information will be added to the constituent record and won't automatically replace the existing data
  • If you've added a field to collect the donor's preferred method of communication, you'll probably need to create a field in Little Green Light to store that piece of information. Adding that as a value to your Communication Tags (formerly known as Tags) is a good way to handle this

Using LGL Constituent ID to establish iron-clad matching

To make sure completed forms match up to relevant constituent records in your LGL account, you can pass the LGL Constituent ID through the email into a hidden field in your form and then map that back to LGL. In other words, just as you are passing along the first name, last name, and other fields from each constituent record into the LGL form they are filling out, you can also choose to pass along their LGL Constituent ID using the merge field [[constituent_id]].

Here's a breakdown of the steps to complete (please make sure you do them in this order):

  1. In your LGL form, add a single-line input field named "LGL Constituent ID". Check the box to make this a hidden field.
  2. In the mapping for your form, add the mapping for this field to the Constituent type field named "LGL Constituent ID".
  3. Go to the Confirmation area for your form and jot down the field number you see when hovering your cursor over this ID field (something like [[field_31]]).
  4. Back in LGL, go to the email you are crafting and in the link where you are passing through the pre-populating values, include "&field_31=[[constituent_id]]" (assuming the field number you found on step 3 was indeed 31). 

In summary, you are passing the LGL Constituent ID into a hidden field in the form, so when the form is returned back to LGL it can be easily matched to the constituent record it belongs to.


Make note of the field numbers in your form

You will need to know the field numbers for each field that you want to populate with data. You can find these numbers by going to your form and clicking through to the Confirmation area. All of your form’s fields are available on the right side of the page, and if you hover over a field name with your cursor a popup will show you the field number. 

NOTE: The field number applies to the LGL merge field value that will pull the data from the record in Little Green Light.

In the example below, you can see that the “First Name” field has the field value of 6 (i.e., “[[ field_6 ]]”).

Write down the number for every field you want to populate.

The typical fields are likely to be:

Field # Form field 
[[field_5]]  Name: Prefix 
[[field_6]]  Name: First Name
[[field_7]]  Name: Last Name
[[field_8]]  Name: Suffix
[[field_9]] Email
[[field_18]] Phone
[[field_11]] Address: Address Line 1
[[field_12]] Address: Address Line 2
[[field_13]] Address: City
[[field_14]] Address: State/Province
[[field_15]] Address: ZIP/Postal Code
[[field_16]] Address: Country

 

The link you build that will pass through the pre-populating values (this is what you will eventually insert into your email) will have two parts, as described below.

Part 1: The link to the form

Find the address (URL) of the form by going to the Share/Publish section for your form in LGL Forms.

Use the  Publish option, in which you point people to the form hosted by LGL Forms.

Copy this URL to an MS Word or Notes document (anywhere you can paste it for later use).

IMPORTANT: To create a successful URL, you will need to pay close attention to the field names, spacing, and text placement when creating your URL. Field numbers, merge field names, and syntax need to be exact, so make sure you double-check their accuracy.

Part 2: Passing through field values

In part 1 above, you copied the URL of the form itself. Now you need to pass through the values you want to populate in the form.

After the form URL, add a question mark: "?"

Then include each field using the following syntax:

&field_6=[[first_name]]

In plain English, this syntax means: “and set field 6 to be populated with the first name field.” 

Your formatted form field number should follow the ampersand, which should be followed by an equals sign and then the LGL Merge Field that should populate the form field. When you send out your actual email, it will pull in (merge in) the values from each constituent record into the link URL. Then, when the recipient clicks on the URL it will take them to the form and carry with it the values for the pre-set fields.

In our example, the selected fields are:

&field_6=[[first_name]]&field_7=[[last_name]]&field_9=[[email]]&field_17=[[phone]]&field_11=[[street]]&field_13=[[city]]&field_14=[[state]]&field_15=[[postal_code]]

Completing the link

Paste in the first part of the link (the part you pasted to an MS Word or Note document), add the question mark "?", and then write out the elements after the "?" Altogether, your final URL will look something like:

https://secure.lglforms.com/form_engine/s/090PIleCbO0IjBb7DnBi3Q?&field_6=[[first_name]]&field_7=[[last_name]]&field_9=[[email]]&field_17=[[phone]]&field_11=[[street]]&field_13=[[city]]&field_14=[[state]]&field_15=[[postal_code]]

Note carefully that the unique ID for our form (090PIleCbO0IjBb7DnBi3Q) is indeed unique to our form. If you copy the above string, you won't go to your form but instead to ours. We provide this link, however, to show you how you can create yours.

CAUTION: Apostrophes will cause problems

If you are passing in a value that includes an apostrophe, such as a last name like "O'Sullivan" or an organization name like "O'Dea", this will break the link as formatted through the email server. As a solution, you could send those emails directly from your own email program, instead of via LGL Direct Email.

Create your email template

In Little Green Light, (remembering that LGL Direct Email needs to be set up before you can do this), go to Mailings > Templates > Email Templates to create a new email template.

In the template, type the content into the template and include a link to the contact form.

Insert the link to the form into your email

This is where the magic happens. When you click the Insert/Edit Link button in the email editor, a dialog pops up where you can insert the link/URL.