Extension: Formula for a Prefilled Form

Prefilled forms can save time and improve accuracy, but manually building the URLs for prefilled forms can be tedious and subject to typos. This extension creates a formula that you can place in that table to generate a unique prefilled URL for each record using the values in that record.

The extension detects the field names for your form and the field names in the table containing values. The resulting formula also encodes any special characters that cannot appear in a URL, such as spaces.

The extension can also create a formula that prefills forms with static text or the value of another formula.

Getting the extension

You can get the extension in the Airtable Marketplace.

Use cases

Use case 1: Create prefilled links for clients You already have a table of client information, and you have an onboarding form, questionnaire, evaluation survey or other form for them to fill out. You want a to email each client a link to the form prefilled with the client’s name and other details. Use the extension to build the formula to for each client.

Use case 2: Click a button to create records with defaults New records tend to have several fields that always have the same combination of values. For each combination, use a button field with the url for the form prefilled with that combination. Click the button to launch the prefilled form and have less to fill out.

Ways of prefilling fields

You can prefill fields with a field value, static text, or a formula field.

Use a field value to include a value specific to a record, such as a name.
Use static text to set a default value.
Use a formula to compute a value that can vary, but does not exist as a field.

Special situations

Prefilling date fields

If you are prefilling a date field, the Airtable form may show a date one day off from the actual date in the record. This is due to a combination of how Airtable stores dates, how Airtable forms interpret dates, and your local time zone.

To avoid this issue, use the following formula to convert your date field to a date string that does not include a time:

IF({Date},DATESTR({Date}))

In the extension, choose to prefill the date field with a formula instead of a field value. Then enter the formula, replacing {Date} with the name of your date field in both places.

If you are using Airtable automations to email the url, you may need to escape the underscore character or the Airtable automations will think that you are trying to include italic text. Whether or not you need to escape the underscore character is highly dependent on how you create your email message, so always test your email template.

If your url needs escaping, create a second formula field that escapes the underscores, then use the escaped url in the automation email:

SUBSTITUTE({Original Url}, "_", "\_")


If you have spaces in your field names, use this formula:

SUBSTITUTE(
  SUBSTITUTE(
    {Òriginal Url}, 
    "_", 
    "\\" & "\\" & "_"
  ),
  "%20",
  "\\" & "\\" & "%2520"
)

Prefilling linked records

If you want to prefill a linked record field with multiple records, you must prefill the form from a rollup field of the primary field in the linked table.

ARRAYJOIN(values, ",")

Prefilling linked records does not work in selected situations.

  • If the value used to prefill the linked record occurs multiple time in the primary field of the linked table, the form cannot tell which record to link to.
  • If the value used to prefill the linked record contains a comma, the form will think that you are trying to link to multiple records. For example, if value is is Doe, Jane, the form will try to link to two different records Doe and Jane. Values with quote marks can also cause problems.
  • If the linked table does not contain the prefilled value, the form field will not be prefilled. Forms cannot create new linked records.

The solution to these situations is to ensure that the primary field values are all unique and do not contain any commas or quotes.

Changing or duplicating the base

  • If you change field names, update the formula for the new field names.
  • If you duplicating the base, the duplicate base will have a new shared url for the form, but the formula will still be using the shared url for the form in the original base. Update the formula to use the new shared url.

Other notes

If you use a formula value in a prefilled form, the link will use the value of the formula at execution time. If you use a button field, it will be the value of the formula when you click the button. If you use a formula field to calculate a url and then put that url in an email, it will be the value when the url was inserted in the email, not the time when the link is clicked. For example, the formula DATESTR(TODAY()) will work well in a button field, but not in an emailed link.