Populate a Form with Salesforce Data 


In this Article
Related Articles

You can populate a form using custom links or buttons created in Salesforce. These links can be added to the Salesforce interface and also included in emails sent from your Salesforce account.

Before you begin, be sure that you have created the necessary fields that you wish to prefill on your form. You can see which fields exist on your form, and their prefill names, in Prefill Through the URL.


Use a Prefilled Link in a Salesforce Email Template

  1. Login to your Salesforce application and click Setup (in the top right corner).
  2. In the left-hand bar, find Admin Setup, click Communication Templates →žœ Email Template.
    • Note that you can also create templates by going to Personal Setup →žœ Email →žœ My Templates.
  3. Click New Template, then select the type of template you wish to create.
  4. Provide your template with a unique name, such as "Contact Happiness Survey."
  5. Create the body of your email template.
  6. At the point where you wish to create your prefilled FormAssembly form link, type:
    <a href="">Please click here to take our survey.</a>
  7. Paste the link to your form into the href attribute, resulting in:
    <a href="http://www.tfaforms.com/90">Please click here to take our survey.</a>
  8. Add to the link the prefill parameters. For instance:
    <a href="http://www.tfaforms.com/90?tfa_Company={!Lead.Company}&tfa_LeadId={!Lead.Id}">Please click here to take our survey.</a>
    Refer to the documentation to find the exact syntax for each field.

    salesforcemail

  9. Save the template.
  10. Use this template when sending your campaign to your users.
Salesforce will automatically populate each email with the appropriate data. For example:
<a href="http://www.tfaforms.com/90?tfa_Company=Smith Co&tfa_LeadId=a0370000006d7yAAAQ">Please click here to take our survey.</a>

Salesforce does have some limitations when it comes to mail merging. Please see here for more details.

See our blog post for more on emailing pre-filled web forms.


  1. Login to your Salesforce application and click Setup (in the top right corner).
  2. In the left-hand bar, click App Setup →žœ Customize
  3. Click Buttons and Links and add a new Custom Buttons and Links.
  4. Enter a label such as "Edit with FormAssembly."
  5. Paste the link to your form. For instance:
    http://www.tfaforms.com/90
  6. Add to the link the prefill parameters. For instance:
    http://www.tfaforms.com/90?tfa_Company={!Lead.Company}&tfa_LeadId={!Lead.Id}
    Refer to the documentation to find the exact syntax for each field.

    #

  7. Save the new link.
  8. Add the link to a page layout (refer to the Salesforce documentation if you need help with this).

That's it! When clicking on the link from your Salesforce account, the form should open up in a new window with the data pre-populated.


Prefilling a Salesforce Checkbox

Checkboxes require a special method of prefilling. Checkboxes prefill simply by having their ID display in the query string. This means that the following URL:

http://www.tfaforms.com/311673?tfa_4&tfa_6

will prefill both checkboxes that have the IDs tfa_4 and tfa_6 (assuming that they are checkboxes). This being the case, you will have to use a special formula to prefill them in the URL of an Salesforce email template.

Here is an example of a sort of formula that you can use:

http://www.tfaforms.com/311673?{!IF(Contact.CheckBox_Field__c=True,"tfa_4","")}

This will only show the ID tfa_4 in the event that there is a value for the Contact field labeled CheckBox_Field__c.

Terms of Service · Privacy Policy