Advanced: Pass values into a form via email
In this article:
- Set up your form
- Create your email template
- Map your LGL Form to your Little Green Light account
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?
I know I would prefer to receive a request to update a form like the one below rather than be asked to fill out a blank form:
This article describes how you can send people to a pre-populated form using an email sent from LGL (using LGL Email):
• In order to email directly from LGL, you must first set up the LGL Email integrated transactional email account using either Mandrill or SendGrid.
• You will also need an LGL Forms account: Knowledge Base article on setting up an LGL Forms account.
• You can not populate forms that are embedded in your website. This approach only works when linking to forms hosted by LGL Forms (all forms are automatically hosted there, so that’s not an issue).
• Certain characters (most notably #) cause issues when you try to pass them through to a form.
• Constituents’ best email, phone, and address information will be passed through even if they are marked as “inactive” in your LGL account.
Step 1: 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. But, you can also add other fields, such as Spouse Name.
You may want to add an option for the respondent to tell you their communication preferences as well.
For help on creating a form, see this Knowledge Base article on creating a new form.
Step 1b: 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. The easiest place to find this is by going to your form and clicking through to the Confirmation area. On the right side you will see all of your form’s fields, and if you hover over a field name with your cursor, you will see a popup that shows you the field number.
In the example below, you can see that the field “First Name” has the field value of 6 (ie., “field_6”).
Write down the number for every field you want to populate.
The numbers will vary depending on the order in which you added fields to your form. In our example, the salient fields are:
Field # Form Fields
[[field_5]] Name: Prefix
[[field_6]] Name: First Name
[[field_7]] Name: Last Name
[[field_8]] Name: Suffix
[[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
Step 2: Create your email template
In your Little Green Light account that has the Mandrill integration set up, go to Mailings / Templates / Email templates to create a new email template.
In the template, write out the email you want to send, and include a link to the contact form.
Step 2b: Create the link to the form
This is where the magic happens. When you click the link button in the email editor, it pops up a field where you can insert the link.
The link you build will have two parts:
Part 1: the link to the form
Find the address (URL) of the form by going to the Publish section for your form in LGL Forms.
Use the Publish option in which you point people to the form hosted on the LGL Forms site.
Copy this URL to a Word or Notes document (anyplace you can paste it for later use).
Part 2: passing through field values
In part 1 above you got the URL of the form itself, but now we need to pass through the values we want to populate in the form.
After the form URL, add a question mark ‘?’
And then include each field using the following syntax:
Which in English would be: “and set field 6 to be populated with the first name field.” When you send out your actual email, it will populate the relevant values from each constituent record into the fields listed.
The first term, field_6, you recognize from the LGL Form on the Confirmation page where we hovered over each field to see the field number.
The second term, first_name, comes from the mail merge list in the LGL Email editor:
In our example, the selected fields would be:
&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 a Word or Note document) and then add the question mark "?" and then write out the elements after the "?" Altogether your final URL will look something like:
Note carefully that the unique ID for my form (090PIleCbO0IjBb7DnBi3Q) is indeed unique to my form. If you copy the above string, you’ll go not to your form but to mine.
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, then it 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 email.
Step 3: Map your LGL Form to your Little Green Light account
We’re pretty much wrapped up with this Knowledge Base article on how to pass values through to a form.
However, 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, see this Knowledge Base article on passing LGL Forms data to your Little Green Light account.
For our purposes here, the key things to know are:
In your matching preferences, you will likely want to allow Name-only matching. Otherwise, anyone who changed their email address will fail to match when the form is re-submitted (though you could always manually match it up during review).
You should therefore also leave the default setting checked that “Requires review before saving.” You’ll want to review these incoming forms before blindly saving them to your LGL account.
In the form mapping, it would be wise to “Add default” 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, not 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 your LGL account to store that piece of information. Adding that as a value to your Communication Tags (formerly known simply as Tags) is a good way to handle that.
Using LGL Constituent ID to establish iron-clad matching
If you have a little energy left, there's an even better way 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 (and please do them in this order):
- In your LGL Form, add a Single-line input field called LGL Constituent ID. Check the box to make this a hidden field.
- In the mapping for your form, add the mapping for this field to the Constituent type field called LGL Constituent ID.
- Go to the Confirmation area for your form and jot down the field # you seen when hovering your cursor over this ID field, something like [[field_31]].
- Back in your LGL account, 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 back to the constituent record it belongs to.