Calculated Fields
A calculated field displays a value produced by a Pre-Submission Workflow instead of asking the visitor to type it. You can also use a Pre-Submission Workflow to add choices to an Enum or Array of Enum field. Use these features to show a looked-up contact name, offer a list of accounts, or generate a reference number.
The visitor sees the value as read-only text. The form treats it like any other field afterward, so the form's Actions read it as {{input.fieldName}}.
Before You Start
Create the Pre-Submission Workflow first. A field can only be mapped to a workflow that already exists and produces at least one custom property.
Populate a Field From a Workflow
- Click Apps in the top bar, then click Forms.
- Open the form and select the Input tab.
- Select Add Field, or select Edit on an existing field.
- Enter the field Name and Label.
- Set Type to String.
- Select Populate this field with a Pre-Submission Workflow output.
- Choose the workflow in Pre-Submission Workflow.
- Choose the property in Property. The list shows the
customproperties that workflow produces. - Select Save, then save the form.
The Property list offers only concrete properties. If the value you want is nested inside an object, select the nested property directly, or add a Render Text and Store as Variable step to the workflow to produce the exact text you want.
Add Choices From a Workflow
Use a dynamic choice field when the available answers depend on another form answer or data from an integration. For example, a workflow can look up the contacts for the account that a visitor selected, then add those contacts to an Enum field.
- Open the form and select the Input tab.
- Add or edit an Enum or Array of Enum field.
- Add any choices that should always appear. Enter a Value for the submitted value and an optional Label for the text the visitor sees.
- Select Populate this field with a Pre-Submission Workflow output.
- Choose a workflow that returns a list, then select that list in Property.
- Configure Value Property. Select a property from each list item, or unlock the field and enter a template such as
{{id}}. - Optionally configure Label Property. Select a property or enter a template such as
{{name}} ({{email}}). Leave it blank to show the value as the label. - Select Save, then save the form.
The form shows its saved choices first, followed by choices from the workflow in their original order. It preserves duplicate values as separate rows. If duplicate choices share a value, the first matching choice supplies the label to workflow actions.
For a workflow result that contains a list of text values, use {{this}} as the Value Property. You can also use {{this}} in the label template.
Choose what form Actions receive
By default, the form's Actions receive the selected value as text. Select Submit the selected value and label as an object when an action needs both parts. This also applies to Pre-Submission Workflows that watch the field.
| Field type | Default input | Value and label input |
|---|---|---|
| Enum | "contact-123" | {"value":"contact-123","label":"Alex Smith"} |
| Array of Enum | ["contact-123","contact-456"] | [{"value":"contact-123","label":"Alex Smith"},{"value":"contact-456","label":"Sam Lee"}] |
For a field named contact, use {{input.contact.value}} for its ID and {{input.contact.label}} for its display text. Both properties appear in the action's variable picker. For an Array of Enum, each selected item has its own value and label.
The visitor's browser always sends the value. Workflow actions receive the label from the form's saved choices or the current completed workflow that supplies its choices.
Rules and Limits
| Rule | Detail |
|---|---|
| Supported fields | Workflows can populate a String value or add options to an Enum or Array of Enum field. |
| Visible fields only | A field populated by a workflow cannot use Hide this field on the public form. For a calculated String field, selecting the checkbox also clears its default, query population, and conditional visibility settings because the workflow supplies the value. Dynamic choice fields can retain defaults, query population, and conditional visibility. |
| One source per field | Each field maps to exactly one workflow and one property. |
| Many fields per workflow | One workflow can populate as many fields as you need. It runs once and fans its results out to all of them. |
| Fields to watch | Another workflow can watch an Enum or Array of Enum with workflow-provided choices. It cannot watch a calculated String field, and a workflow cannot watch the field whose choices it supplies. |
| Text values only | See the conversion rules below. |
| Choice list required | Dynamic Enum fields must map to a list. Each rendered value must contain text. |
| Option limit | A field uses at most the first 1,000 dynamic choices returned by its workflow. |
How values convert to text
| Workflow value | What the field shows |
|---|---|
| Text | The text, up to 10,000 characters. |
| A number | The number as text, such as 42. |
| True or false | true or false. |
| An object or a list | No value. The field reports that the workflow did not return text. |
| Text longer than 10,000 characters | No value for that field. Other fields fed by the same workflow are unaffected. |
What the Visitor Sees
| State | What appears |
|---|---|
| Running | A spinner and the text "Calculating…". |
| Finished | The value and the text "Calculated successfully." |
| No value at the property | "The workflow did not return text at the selected property." |
| Failed | "This value could not be calculated.", or the specific message from the workflow. |
| Session expired | "This calculation expired. Please try again." |
The submit button reads Calculating... and stays disabled while any calculated field is still running.
If a calculated field is marked Required, the visitor cannot submit until the workflow supplies a value.
Using the Value After Submission
Calculated fields behave like normal input fields once the form is submitted:
- The form's Actions read the value as
{{input.fieldName}}. - The value appears in the submission's history entry alongside the visitor's answers.
- Field visibility rules and submission conditions can compare against the field.
Correction Requests
When a workflow pauses for a correction using the Request Form Corrections action, calculated fields are always read-only. The recipient can see the value but cannot change it, because the workflow owns it.
Security
The browser never decides what a calculated field contains. At submission the server looks up its own stored workflow result and rebuilds the value from the form's current configuration. If a visitor edits the page to send a different value, the server replaces it.
If the workflow behind a calculated field has no successful result at submission time, the form rejects the submission rather than accepting a blank or stale value.
Related Topics
- Pre-Submission Workflows: build the workflow that supplies the value
- Submission Conditions: block a submission when a calculated value is wrong
- Render Text and Store as Variable: build a text value from other properties
- Forms Tutorials: worked examples that populate fields from a PSA