Skip to main content
Available starting with FlowX.AI 5.3.0: UI Events enable real-time interaction handling directly within Reusable UI Templates, allowing you to capture user interactions and respond immediately without process execution.

Overview

UI events allow you to define JavaScript expressions that execute when users interact with UI components. Unlike UI actions that communicate with the backend, UI events operate entirely on the client side to update local data instantly. UI events were introduced to reduce UI load time and address related UX issues. The expressions are evaluated by the SDKs at runtime on the front-end side, leading to faster load times. They are intended for more complex business logic than what is handled by simple hide expressions or computed expressions.

No server roundtrip

Update data locally without waiting for backend responses

Instant feedback

Provide immediate UI updates as users interact with components

Simplified logic

Replace complex business rule chains with simple expressions

Computed expressions

Use JavaScript to calculate and transform data on the fly

Key characteristics

CharacteristicDescription
Client-side evaluationExpressions are executed on the client side by the SDKs, not on the server
Action timingEvaluated right before executing a UI action (if one is configured), but not exclusive to actions
Local data updatesUpdated variables are stored locally on the UI and not available on the process engine’s server data store until a submit action is executed
Data source requirementsMust rely only on properties already displayed on the screen; if a property used in the expression is not configured on the page to be sent from backend to frontend, the expression will fail
Component availabilityCurrently available only for form elements (see supported components)
Data availability: UI event expressions can only access data that is already being sent from the backend to the frontend for display on the current page. If you reference a property that isn’t configured to be sent to the UI, the expression will fail.

Traditional approach vs UI events

Previously, updating derived values required a multi-step process:
1

User changes input

User modifies a form field value
2

UI action triggers

A UI action sends data to the backend
3

Business rule executes

Server-side business rule calculates new values
4

Data returns to UI

“Send data to user interface” action pushes updated data back
With UI events, steps 2-4 are replaced by a single client-side expression that evaluates instantly.

Configuring UI events

UI events are configured in the UI Designer through a dedicated section located above the UI Actions panel.

Event configuration structure

Each event configuration consists of:
  • Event trigger: The user interaction that initiates the expression (e.g., onChange, onClick)
  • Expression: A JavaScript computed expression that calculates and returns new data

Platform configuration

UI events are stored in the component’s platformDisplayOptions under the events property:
{
  "platformDisplayOptions": {
    "platform": "generic",
    "flowxProps": {
      "events": [
        {
          "event": "onChange",
          "expression": "const prc = ${client.debt} / ${client.income};\nreturn {\n  \"client\": {\n    \"debtPrc\": prc\n  }\n}"
        }
      ]
    }
  }
}
UI events are available in both the Process UI Designer and the Reusable UI Templates Designer.

Writing event expressions

Event expressions use the same JavaScript syntax as computed values, with one key difference: instead of returning a single value, event expressions return an object that updates the local data store.

Expression syntax

// Access process parameters using ${} syntax
const calculatedValue = ${client.debt} / ${client.income};

// Return an object to update local data
return {
  "client": {
    "debtPercentage": calculatedValue
  }
}

Comparison with business rules

AspectBusiness RuleUI Event Expression
Input access${} syntax${} syntax
Logic languagePython, JavaScript, MVELJavaScript only
Output syntaxoutput.put(key, value)return { }
ExecutionServer-sideClient-side (SDK)
LatencyNetwork roundtripInstant

Expression examples

  • Calculate percentage
  • Conditional formatting
  • String transformation
  • Array operations
Calculate debt-to-income ratio when income or debt changes:
const prc = ${client.debt} / ${client.income};
return {
  "client": {
    "debtPrc": prc
  }
}

Supported components and events

UI events are currently available for form elements. Each UI component type supports specific event triggers:
ComponentEventTrigger Description
InputonChangeWhen the input value changes
Text areaonChangeWhen the text content changes
SelectonChangeWhen a selection is made
Multi selectonChangeWhen selections change
Date pickeronChangeWhen a date is selected
SlideronChangeWhen the slider value changes
RadioonChangeWhen a radio option is selected
CheckboxonChangeWhen the checkbox state changes
Segmented buttononChangeWhen a segment is selected
SwitchonChangeWhen the switch is toggled
Future enhancement: An improvement being considered is the ability to reuse event expressions across multiple elements, as many behaviors depend on multiple elements that should share the same behavior.

UI events in Reusable UI Templates

UI events work within Reusable UI Templates. When using events in templates, ensure that any keys referenced in the expression are properly mapped through the template’s input parameters.

Input mapping requirements

For an expression like:
income = ${client.income}
debt = ${client.debt}

if (income && debt) {
    return {
    "client": {
        "ratio": ${client.debt} / ${client.income}
    }
    }  
} else {
    return {}
}
The template must have client.debt and client.income configured as input parameters to receive values from the parent process context.
When designing reusable templates with UI events, document which input parameters are required for the events to function correctly.

Runtime behavior

Execution flow

When a trigger event occurs:
1

Event triggered

User interaction fires the configured event (e.g., onChange)
2

Expression evaluated

The SDK evaluates the JavaScript expression synchronously
3

Local data updated

The returned object merges into the local data store
4

UI refreshed

Components bound to the updated data re-render automatically

Coexistence with UI actions

UI events and UI actions can be configured on the same component. When both are present:
  1. The UI event expression evaluates first (right before the action)
  2. The UI action executes after the event completes
This allows you to perform local calculations before sending data to the backend.

Local vs server data

Variables updated by UI events remain local to the UI until a submit action is executed. The process engine’s server data store does not receive these updates until data is explicitly submitted.
This means:
  • Immediate UI updates without server latency
  • Multiple calculations can be performed before submitting
  • Server-side data only updates when you trigger a data submission action
UI event expressions are synchronous computations. Avoid complex operations that could block the UI thread.

Best practices

Keep expressions simple

UI events are designed for lightweight transformations. For complex business logic, continue using server-side business rules.
// ✅ Good: Simple calculation
const total = ${cart.subtotal} * 1.1;
return { "cart": { "totalWithTax": total } }

// ❌ Avoid: Complex async operations or heavy computations

Ensure data is available on the page

UI event expressions can only access data that is already configured to be sent from the backend to the frontend. Before using a property in an expression:
  • Verify the property is bound to a UI component on the current page
  • Ensure the data is included in the page’s data context
  • Test with actual data to confirm availability

Handle missing data gracefully

Always account for potentially undefined values:
// ✅ Defensive coding
const income = ${client.income} || 0;
const debt = ${client.debt} || 0;
const ratio = income > 0 ? debt / income : 0;
return {
  "client": {
    "debtRatio": ratio
  }
}

Use meaningful return structures

Return objects should mirror your data model structure:
// ✅ Matches data model hierarchy
return {
  "application": {
    "calculations": {
      "monthlyPayment": payment,
      "totalInterest": interest
    }
  }
}

Test expressions thoroughly

Before deploying, verify your expressions handle:
  • Valid input values
  • Empty or null inputs
  • Edge cases (zero, negative numbers, empty strings)
  • Different data types

Troubleshooting

Expression not evaluating

Symptoms: Data doesn’t update when interacting with the component Solutions:
  • Verify the event type matches the component (e.g., onChange for inputs)
  • Check that process parameter syntax uses ${} correctly
  • Ensure the expression includes a return statement
  • Confirm the component has the event properly configured

Property not available error

Symptoms: Expression fails because a referenced property is undefined Solutions:
  • Ensure the property is configured on the current page to be sent from backend to frontend
  • Verify the property is bound to a UI component or included in the page’s data context
  • Only rely on properties that are already being displayed on the screen
  • Check that nested properties exist in the data model

Return value not applied

Symptoms: Expression runs but data doesn’t change Solutions:
  • Verify the return object structure matches your data model
  • Check for JavaScript syntax errors in the expression
  • Ensure you’re returning a valid object, not undefined or null

Performance issues

Symptoms: UI feels sluggish during interactions Solutions:
  • Simplify complex expressions
  • Avoid array operations on large datasets
  • Move heavy computations to server-side business rules