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
    https//ilovecats.com/contact?utm_source=blog&utm_medium=utm-tagging-post&utm_campaign=url-tagging-blog-link-feb-2020
  • 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.
    https//ilovecats.com/vote?campaign=worldcatevent2025+campaign_id=00x252F00N4A00000FS1Ny

 

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:

https://formstack.io/73433

 

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.

    1_api_name.png

    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.

    2_inspect.png


Step 4: Create Prefill URL

The new prefill URL will be the combination of the form URL (https://formstack.io/73433) and the query string and value (Contact.MailingCity=Toronto)


https://formstack.io/73433?Contact.MailingCity=Toronto 

 

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

 

https://formstack.io/73433?Contact.MailingCity=Toronto&Contact.MailingState=ON 

 

💡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?
1 out of 8 found this helpful

Comments

0 comments

Article is closed for comments.