Prefill by URL Query String

💡First: See this article for a list of all the methods you can use to update or relate to existing Salesforce data with forms


You can prefill your forms quickly and easily by supplying static field values in the URL to the form page. The most common use case is for supplying UTM tracking codes or Marketing Campaign IDs. 


When to Use Prefill by URL Query String?

Prefilling forms by URL static values is the most common method with any form builders. We rarely recommend this method because it means your Salesforce data is exposed in the URL and may be sent and forwarded in insecure email systems. We recommend using encrypted Dynamic Prefill URLs that pull live data when the form is accessed in most cases. 


Some good scenarios to use URL query string prefill parameters are when the data is not of great security or privacy concern.

Examples include:

  • Event feedback with a Campaign ID in URL
  • Contact Us forms with UTM tracker codes
  • Forms with predetermined data that is not in Salesforce but is available to the email marketing system sending out the links. This is most commonly UTM codes or marketing campaign ID that can be set on hidden fields or passed on to the next page or cookie.


How to use Prefill by URL Query String?


Step 1: Create a form
To create a query string, we must first have a Form with a URL. For example:


Step 2: Identify fields to prefill
Next, we must determine which fields we want to pre-populate. For this case, let's say we want to pre-populate the "Mailing City" field on Contact object with the value "Toronto".

Step 3: Retrieve API names of fields
There are two ways to retrieve the API name of the fields on your form.

In this case, our API Name for the field is Contact.MailingCity

  1. Open the form for editing in Formstack app in Salesforce and go to the field settings of the field you want to prefill. The API name should be visible. It is available for Salesforce and General fields.


    2. You can also right click on the field in your loaded form and find the field name. This is a little tougher to read and differs with each browser so we recommend the initial method in-app.


Step 4: Create Prefill URL

The new prefill URL will be the combination of the form URL ( and the query string and value (Contact.MailingCity=Toronto) 


If we have multiple fields to prefill in this way, we must separate the fields with Ampersands (&): 


💡This can be done for any textbox, text area, single or multi-select picklist, radio or checkbox field as well for both Salesforce and General Fields.

Was this article helpful?
2 out of 11 found this helpful



Article is closed for comments.