Expression Button
The Expression Button executes a Form Expression and stores the value in the Value variable.
Use cases:
- When you want to set a variable when the user clicks a button.
- When you want to set a variable when a panel is rendered, for example inside a wizard. To do that you can place the button inside a panel and set its visibility to false and auto execute to true.
- To have a "calculated variable" setting auto execute and timer.
When you would like to react on the change of another field you can use the event listeners of the field which changes instead.
Example: Dynamic Grocery Shopping List
Expression buttons can be triggered in several ways beyond a manual click:
- Automatically on page load (auto execute)
- Executed periodically (timer)
- Bound to a variable (auto execute expression — re-executes when the watched variable changes)
This example builds a grocery shopping list that uses expression buttons to automatically calculate item totals and the grand total.
Grocery Item Sub Form
First, create a sub form that represents a single grocery item. This form will be embedded as a multi-instance sub form in the main grocery list form.

This sub form has 5 elements:
Grocery Item: A static single select bound to {{item}} with Storage set to Full value so the full item object (including its price) is available.

Quantity: A number field bound to {{quantity}} with a default value of 0.
Item Total: A text field bound to {{itemTotal}}, disabled since it is calculated by an expression button.
Reset Quantity: An expression button that resets the quantity to 1 whenever a new item is selected. Configure it as follows:
- Auto execute: bind to
{{item}}— triggers whenever the item selection changes - Value:
{{quantity}}— the variable to write to - Expression:
{{1}}— the value to set
Totalizer: An expression button that calculates the item total. Configure it as follows:
- Auto execute: bind to
{{quantity}}— triggers whenever the quantity changes - Value:
{{itemTotal}}— the variable to write to - Expression:
{{flw.numberFormat(item.value*quantity,"en_US", currency, "2", "USD")}}— multiplies quantity by item price and formats as USD
Check the Front End Functions for the available flw.* functions.
The item form can be tested in the form designer's runtime preview:

Grocery List Main Form
Create a main form that embeds the item sub form:

This form has 4 components:
Sub Form: Points to the grocery item form, configured with sub form data bound to {{groceries}} and multiple elements enabled with add/delete buttons.

Totals Panel: A panel containing the total fields. The panel's Visible property is set to {{flw.exists(groceries)}} so it only appears once items have been added.

Total Cost Field: A disabled text field bound to {{groceryTotal}}, calculated by the totalizer expression button.
Totalizer Expression Button: Calculates the grand total whenever the {{groceries}} variable changes (items added, deleted, or updated). The expression uses flw.sum() and flw.mapAttr() to sum the itemTotal values:
{{flw.numberFormat(flw.sum(flw.mapAttr(groceries,'itemTotal', "en_US", currency, 2, "USD")))}}

Publish and Run
Create a simple process with the grocery list form as the start form, then publish the app.

In Flowable Work, start an instance of the process and the grocery list start form is presented:

Example: Basic
Properties
General
| Attribute | Type | Description | Category |
|---|---|---|---|
| Model Id | String | This is a unique id for the component. | Every field on a form model needs a unique ID, which is automatically generated but can be changed if needed (e.g. to reference in expressions or for debugging purposes). If the field type supports rendering a label, and most types do, it can be configured here. This label is a displayed on the form to the end user and typically indicates what value is expected in the field. The documentation property holds free-form text that can be used to give more details about this script button, like its purpose, usage in other models, etc. |
| Label | Text | The label attribute adds a label to the component. | |
| Label position | Selection:
| The position of the label, you can choose between left or top. | |
| Label tooltip | Text | When it is defined, a question mark icon will appear in the component label. When the user hovers over it it will show this text in a tooltip. | |
| Documentation |
