Skip to content

Prefill a form with parameters

How-to6 minPractitioner

Before you start

Prefill a form so people start with the right values already in place, for example a purchase request that opens with the department filled in. You can set the values in the form itself, with form parameters, or in the link that opens the form.

  1. Open the Forms tab of the module and click Form rules. The Form Settings panel opens.
  2. Click Add Parameter. A box appears.
  3. In Form field name, choose the field to fill, for example Department.
  4. In Smart script to set value to, write the value, for example 'Procurement'.
  5. Click Save in the panel, then Save on the form.
The Form Settings panel with the Add Parameter button beside the text: Form parameters allows you to set form field values by default on opening them.
    Add Parameter adds a field and a value.
    Save closes the panel. Then save the form.

Add one parameter per field. The bin icon at the start of a box removes it. Give every parameter a field and a value, so the save check has nothing to flag.

The value is a Smart ScriptSmart ScriptBeezr's scripting language (engine name Beezl) used in fields, rules, filters, workflow values and dashboards.Open glossary ↗. A quoted text such as 'Procurement' gives a fixed value. Plain text without quotes works as a fixed value too.

Add the field’s system name and its value to the link that opens the form:

add.xhtml?moduleId=12&department=Finance

On a public form add the same pair after the FORM_KEY:

published/public-form.xhtml?FORM_KEY=abc123&department=Finance

The system name is shown under the label of each field card in the Form builder. A Button with the action Dynamic Form fills the form it opens in the same way: its URL Parameters pair a Target form field to fill with a Source field / value. See Add a button to a form.

If the link carries a value for a field, that value is used. If it does not, the form parameter fills the field. A field with neither starts with its own default value, or empty.

  • Use the system name in links, such as department, and not the label.
  • Pick the field from the list in Form field name so the name is spelled correctly.
  • Test the form with a new record after you save, so you see the defaults people see.

Check yourself

A form parameter sets Department to 'Procurement'. The link that opens the form ends with &department=Finance. Which value does the field show?
Show the answer

Finance. The parameter supplies a default only when the link has no value for that field. The value in the link wins.

What name goes in a link to prefill a field?
Show the answer

The field's system name. The link uses the field's system name, for example department.

What's next

Last checked