Skip to content

Prefill

Prefill saves your supporters typing. When someone arrives with a link that identifies them, the form opens with their details already filled in. You can combine it with one-click links.

There are three ways to prefill.

This looks up the supporter in Salesforce and fills the form with their data.

  1. Go to CampaignSuite > Salesforce, section Gravity Forms Settings.
  2. Switch on Enable Salesforce prefill (“Enable prefill of Gravity Forms fields with Salesforce data”).
  3. Under Prefill conditions, set which link parameter finds which Salesforce field. By default the parameter contact is matched to Contact.Id. Choose contact, account or email, or type your own parameter, and select the Salesforce Field it must match.

With the defaults, a link such as https://yoursite.org/donate/?contact=003... prefills the form for that contact.

  1. In Gravity Forms, open your form and go to Settings > CS | Prefill.

  2. Under General settings, switch on Can prefill form. When several sources exist, switch on Enabled instead and select Salesforce as the Prefill Source.

    General settings of the CS | Prefill add-on with Can prefill form switched on

  3. Under Salesforce Prefill Settings, pick a form field on the left (Form fields) and the Salesforce field it is filled from on the right (Mapping). Add a row for each field.

Salesforce prefill mapping of a form: name, email and phone fields linked to Contact fields, plus the Contact ID in a hidden field

Fields that are often mapped are the contact’s First Name, Last Name, Email, Phone and Salutation, and the organisation name through Account. It also helps to map Contact ID to a hidden field, so feeds can update this contact.

  1. If this form needs different conditions from the rest of the site, switch on Use custom prefill condition and give it its own Parameters and Values.

Only show form when prefilled hides the form unless a supporter was found, which suits personal links. Fallback message is what visitors see instead of the form in that case.

  • A link with a real identifier, such as an email address, shows that person’s data to anyone who has the link. Only share personal links with the person they are meant for.
  • Every parameter needs a value, because an empty parameter finds nothing.
  • When a link has several parameters (for example contact and email), all of them must be present, and parameters that point to the same Salesforce object must all match the same record. Prefill only happens when exactly one record is found. With no match, or more than one, the form stays empty.
  • Lookups are remembered for about five minutes. After you change a record in Salesforce, a link can show the old data for a few minutes, so wait a little before you test a change.

Gravity Forms can fill fields from the link. Switch on Allow field to be populated dynamically on a field and give it a Parameter Name, for example amount. The link ?amount=50 then fills that field. This is standard Gravity Forms behaviour, and it also works for the Amount Choice field.

Switch on Enable prefill from POST data in the form settings to fill fields from data that another page or system posts to your form page. If you also switch on Format number Prefill to match GravityForms currency format, numbers like 10.5 are converted to the currency format of the form.

On any field, you can set Visibility to Hidden if prefilled. A field that was prefilled with a valid value is then hidden, and otherwise it stays visible. See Fields.