setUserData and triggerAction, and extra context about how the Computed Field was triggered.
How to create a Computed Field
1
Create a Computed Field
- Go to the Logic sidebar and click on the Computed Fields tab.
- Click
+ Add New Computed Field. - Give it a key to be used for the output value in the User Data JSON object, like
full_name. - Hit
Add.
2
Write your custom code
- Computed Fields must start with a function called
result(). - You can write any custom JS code inside the
result()function. - The first argument of
result()is the User Data, and the other arguments are described here. - The code will execute on the frontend, in the main window environment, so has access to window functions and variables.
Computed Field Options
Computed Fields have several configuration options that control how they behave:Storage
Storage
Controls where and how the computed field result is stored:
- Save to User Data (default): The result is saved to the User Data JSON object and persisted in cookies/localStorage
- Do Not Save: The result is calculated but not saved to storage. It’s still available in the User Data during the session
- Save to Cloud Only: The result is saved to the Embeddables database but not stored locally in cookies/localStorage
Inputs
Inputs
Specifies which User Data keys the computed field depends on. When any of these keys change, the computed field will have access to their values in the
userData parameter.Example: If you add first_name and last_name as inputs, your computed field will receive these values:Triggers
Triggers
Specifies which User Data keys will trigger the computed field to re-run. This is useful when you want the field to recalculate only when specific values change, even if it depends on other inputs.Use case: You might have a computed field that uses many inputs but should only recalculate when a specific key changes (like
recalculate_total).Include and Watch Full User Data
Include and Watch Full User Data
When enabled, the computed field:
- Receives the entire User Data object (excluding its own key to prevent circular references)
- Re-runs whenever any User Data value changes
- Useful for computed fields that need access to all data or should update frequently
Include, but Not Watch Full User Data
Include, but Not Watch Full User Data
When enabled, the computed field:
- Receives the entire User Data object (excluding its own key)
- Only re-runs when the keys specified in Inputs or Triggers change
- Useful when you need access to all data but want to control when recalculation happens
Async
Async
Marks the computed field as asynchronous, allowing you to use
await and promises inside the function.Example:Async computed fields are evaluated separately from synchronous ones. Sync fields are computed first for faster updates, then async fields are computed afterward.
Wait Before Updating [ms]
Wait Before Updating [ms]
Only available when Async is enabled. Adds a debounce delay (in milliseconds) before the computed field recalculates. This prevents excessive recalculations when inputs change rapidly.Use case: If a user is typing in an input field and you’re making an API call based on that input, you might set this to 500ms to wait until they stop typing.
Include Loading State
Include Loading State
When enabled, the computed field key will be set to
"_loading" while the async computation is in progress. This allows you to show loading indicators in your UI.Example:Set Value as Class on Flow
Set Value as Class on Flow
When enabled, the computed field’s value is added as a CSS class to the flow container element in the format:
field-value-{key}-{value}Example: If your computed field key is user_type and it returns "premium", the class field-value-user_type-premium will be added to the flow container.Use case: This allows you to style your flow differently based on computed values using CSS:Example Computed Fields
Full Name
Here’s an example of a Computed Field calledfull_name, that takes the user’s first and last name and concatenates them together.
BMI
Here’s an example of a Computed Field calledbmi, that takes the user’s weight and height and calculates their BMI.
User is/is not over 18 - from a single date input
Here’s an example of a Computed Field calledis_over_18, that takes the user’s date of birth and returns a boolean value indicating whether they are over 18.
User is/is not over 18 - from three dropdowns
Here’s an example of a Computed Field calledis_over_18, that takes the user’s date of birth, entered by the user into month, day and year dropdowns, and returns a boolean value indicating whether they are over 18.
Learn more about Custom Code
Read more about writing Custom Code in Embeddables, including all the
available arguments passed in to the function.

