Actions

Actions are the behavior layer: what happens when a button is clicked, a value changes, a record is saved, or a menu entry opens. Studio designs the same action types documented in the Actions chapter.

Action kinds

The Actions tab’s New menu offers one entry per kind:

Kind Typical use Reference

Action View

Open a grid/form/dashboard, optionally filtered

Action View

Action Attrs

Change view attributes live — hide, require, set a domain

Attrs Action

Action Record

Set field values on a record (defaults, computed updates)

Record Action

Action Method

Call a Java method of a module

Method Action

Action Script

Run a script — the escape hatch when nothing declarative fits

Script Action

Action Validate

Show errors, alerts and confirmations before proceeding

Validate Action

Action Condition

Check preconditions field by field

Condition Action

Creating an action

  1. Open the revision’s Actions tab, click New and pick the kind.

  2. Give it a readable, prefixed name — action-todo-validate. This name is what views and menus reference.

  3. Fill in the kind’s editor: a validate action lists its validators (message plus firing condition), a view action its target views, parameters and context, a script action its code with syntax highlighting…

  4. Save.

Action designer

Two mechanics apply everywhere:

  • Chaining — an event handler may list several actions separated by commas, and the special name save persists the record mid-chain: action-validate,save,action-send-mail.

  • Expressions — computed values use the eval: prefix (eval: date.plusDays(7)); unprefixed values are taken literally. A condition on an action or item makes it fire selectively.

Wiring actions

Where an action runs from:

  • View events — a form’s onNew/onLoad/onSave, a field’s onChange, a button’s onClick (Views).

  • Menu entries — a menu item opens its action, usually an action view (Menus).

An action view is also how a custom model gets its entry screen: point it at the model’s grid and form views, then attach it to a menu.

Gotchas worth knowing

Action Record works on JPA entities only. It targets real entity properties, so on a custom model the values silently don’t persist. For custom models: set defaults with the field’s default value in the model designer, and use an Action Script for computed values and transitions.
  • Prefer Action Validate for user-facing checks — error blocks the operation, alert asks to continue — rather than failing inside scripts.

  • Use Action Attrs with onLoad/onChange to adjust what the user sees (hide a panel, require a field, narrow a relation’s choices) without touching data.