Salesforce Prefill Connector 


In this Article
Related Articles
  • None

Overview

The Salesforce Prefill Connector allows you to retrieve data from your Salesforce org and display a prefilled form to your respondents. Learn more about why it's handy. 

Provided you have set up a prefilling link and a query parameter in your Salesforce Prefill Connector, you will be able to pull information from Salesforce records directly into your form.  More information on this setup can be found in the videos below.


Requirements


You'll need FormAssembly's Premier or Enterprise Plan.  You will also need to create a prefilling link and setup a query parameter in your connector.  Please watch the videos below for more information on these two steps.


 

Note: The prefill connector will not run if you have not setup both a prefilling link and a query parameter in your connector.  A standard link to your form that does not contain a query parameter cannot be used for prefilling.  

Additionally, this connector doesn't work with forms published using the copy & paste method.

Recommended Publishing Methods
  • REST API
  • WordPress
  • Salesforce Portal/Communities
  • Hosted by FormAssembly

Watch the Videos

Salesforce Prefill Connector 40:07


This demonstration of the Prefill Connector shows:

  • Prefilling with two records through a relationship with a lookup to a single custom field.
  • Two scenarios on how to initiate the Prefill Connector.
  • A discussion on secure versus unsafe query parameters.


The Salesforce Prefill Connector Part 2 36:58

This demonstration of the Prefill Connector shows:

  • Prefilling different field types.
  • Prefilling conditional triggers & hidden conditional triggers.
  • Prefilling repeated fields and sections.


 

Prefill & Update Loop with Salesforce (Premier & Enterprise) 46:54


See the full loop of prefilling a form with Salesforce data using the Salesforce Prefill Connector, then updating multiple records in Salesforce.


This video shows:

  • A short of updating and prefilling.
  • Building a prefill update loop.






Configure the Connector

Step 1. Credentials

For additional information on these steps, and a video walkthrough, please see the videos above.

To begin, first choose a Salesforce profile which has API access and read access to the Salesforce objects you intend to retrieve.

Enter the Salesforce username, password, and security token for the profile which you will use to query your Salesforce org (i.e., search for matching data).

 

Step 2. Lookup Query


First decide:

  1. Which record do you want to prefill with?
  2. Which Salesforce field will you use to uniquely identify each record?
Click the Configure your First Lookup button to get started.

  1. In the select an object drop-down menu, choose your object to lookup.
  2. Click Ok.
  3. In the area labeled Lookup #1, choose the Salesforce field which you will query.
  4. Select the operator in the middle drop-down, i.e., Equals.
  5. Select an unsafe query parameter. A parameter uniquely defines your query.
  6. Enter a value to represent the parameter. This is very flexible, and it's up to you. In this case, the value is acctid, short for account ID.
     
    Note: This is case sensitive and you should not use any special characters (i.e. &,_,@) or spaces.  In general, it is best to keep this query parameter simple and text-based.
  7. Add additional parameters, if needed.

 

Decide when to prefill.


Under each lookup, confirm what to do if/when records are found.

 

Step 3. Field Mapping


Next, map the fields you would like to prefill in the form. Select a field from your form on the left, select the matching field in Salesforce on the right, and click Ok.

Click Map Another Field for each field in your form that you want to prefill.  

Any time you add a new field to your form it will need to be mapped in your connector, even if it has the same name as a previously deleted field.

When prefilling checkboxes from Salesforce the connector will automatically detect which Salesforce fields are checkboxes and give you the option of selecting "checked" or "unchecked" for your mappings in the connector.  When mapping fields, or prefilling through the URL, you can also use "0" to uncheck a checkbox or "1" to check a checkbox.

When dealing with upload or attachment fields, it is not possible to prefill files of any kind, although it is possible to prefill a file name.
 

Step 4. Working with Multiple Records


If you need to retrieve more than one record to prefill your form, click Add another lookup or Add an Object dependent on... to set up another query and field mapping set.


On subsequent steps of the connector, you'll find an additional lookup option (a lookup result) to reference a previous lookup.


Direct Your Respondents to a Prefilled Form

  • Send a Prefilled Link
    • Send a custom link in an email containing an identifying value.
  • Use Two Forms
    • The respondent enters an identifying value into Form 1. After clicking submit, the respondent is directed to a prefilled Form 2.
Note: You must build a prefilling link for either option. Watch the video.  If you send a standard form link (e.g. www.tfaforms.com/123456) you will not be able to trigger the prefill connector to run.  Prefill links have a specific format and must be aligned with your query parameter.

 

To build your prefill link, you'll need:

 

The form's address (URL)

    • Go to the Publish page and copy the public address under Your form is publicly available at this address. If you've published the form on your own website, you can also use that URL.
The parameter name you want to fill

    • This is the name you gave the parameter in the connector. In this example, it would be acctnum.

 

Build Your Link

Please make sure to follow all the steps listed below when building your prefilling link.  A standard form link will not be able to trigger the prefill connector to run.

You can use a basic text editor to build your link, like Notepad or TextEdit. Here's a form link from the Publish tab, where 283230 is the form ID.

http://enterprisedemo.formassembly.com/283230


Now, copy your form URL from the Publish page, and place a question mark after it.


Here's what our example link looks like:

http://enterprisedemo.formassembly.com/283230?


Next, use the query parameter that you set up in your connector and add that after the question mark. Here, we're using a query parameter that represents the Account Number, acctnum.


Add an equals sign after the parameter name.

http://enterprisedemo.formassembly.com/283230?acctnum=


After the equals sign, you'll want to enter the data that will prefill the form field.  If you are using a Salesforce Email template to send out your link, this value would be a merge label, for example: {!Contact.Id}

http://enterprisedemo.formassembly.com/283230?acctnum=1a2b3c4d


Learn more about building a link to prefill forms.



 

Send a Prefilling Link


After you've built the link, you can place it in an email as is, or you can make it dynamic by using a merge field from an email system.


Here's an example for Salesforce merge fields:

http://enterprisedemo.formassembly.com/283230?acctnum={!Account.AcctID}


Here's an example for MailChimp merge fields:

http://enterprisedemo.formassembly.com/283230?acctnum=|MERGE5|

 

Use Two Forms


In this setup, the respondent would initiate the prefilling of Form 2 by submitting Form 1 after entering their uniquely identifying value into the form field.


In the Notifications tab of Form 1, the redirect field would need a URL similar to:

http://enterprisedemo.formassembly.com/283230?acctnum=%%tfa_1%%

The field alias %%tfa_1%% will be filled by the value entered into the field on Form 1.


In the Publish page for your FormAssembly form, you'll find a link at the bottom of the page: Show how to prefill form data dynamically. Click this link to find the field alias(es) you'd like to prefill with.


Additional Methods to Query the Salesforce Database

Session Parameters


Session parameters are only available if Salesforce community authentication is enabled for your form.


To use a session parameter, select Formula in the value [2] drop-down menu, and enter one of the following aliases (including the %% signs):

Salesforce Portal Aliases:
%%SF_PORTAL_USER_ORGID%%The Organization ID of the portal user
%%SF_PORTAL_USER_USERID%%The User ID of the portal user
%%SF_PORTAL_USER_PROFILEID%%The Profile ID of the portal user
%%SF_PORTAL_USER_ROLEID%%The Role ID of the portal user
%%SF_PORTAL_USER_USERNAME%%The username of the portal user
%%SF_PORTAL_USER_EMAIL%%The email of the portal user
%%SF_PORTAL_USER_FULLNAME%%The full name of the portal user
%%SF_PORTAL_USER_LOCALE%%The locale configured for the portal user
%%SF_PORTAL_USER_TIMEZONE%%The time-zone configured for the portal user

See the Salesforce Developer documentation for a more complete description of each value.

Secure Parameters

You can visit our Prefill Lookups Using Secure Parameters page in our knowledge base to learn more about how to implement this functionality.


Terms of Service · Privacy Policy