Skip to main content

Action system overview

The action system runs on event hooks (onChanged, onCreated, onBeforeSave, onAfterSave) and provides template automation without writing scripts.

Action input formats

Actions can be specified as:
  • A single action string
  • A pipe-delimited chain: action1 | action2
  • A JSON array string
  • A programmatic string array

Conditional actions

Actions can be guarded with a when clause:
The condition language includes: See Templates and syntax for the full conditional expression reference.

Runtime variables

Common runtime variables available in action expressions: Nullish fallback is supported: ${selectedObject.DefaultStatus ?? "New"}

Built-in actions

Practical action patterns

Refresh dependent lists

Capture previous state

Conditional workflow update

Validation gate on save

Choose declarative logic or a script

Use a built-in action when the requirement is a direct form operation, such as setting a value or refreshing a query. Use a script when the operation needs a reusable calculation or an integration contract. Start with the tested Script Engine examples, then connect the chosen type to the form. Keep a save-time rule separate from a click-time convenience. A button that fills fields does not guarantee that a later save still satisfies the business rule; validate at the appropriate save boundary as well.

Scripting

Integration paths

There are three ways to integrate scripts:
  1. autofillScript on EditableField — field-triggered autofill
  2. ScriptButton — explicit user-triggered execution
  3. callScript action — part of an action chain

Script types

Caseflow forms use the autofill and action types below. Document event hooks are a separate background extension point:
Triggered by field changes. The request context includes:
  • Application name
  • Class name
  • Object ID
  • Trigger attribute and value
  • Target attribute list
The expected result is a values map ({"values": {...}}) which is applied to the target attributes.

ScriptButton vs callScript

  • Use ScriptButton for explicit user-triggered operations — “run this script now”
  • Use callScript action when the script should be part of an action chain, typically as a side effect after a change or save

Error handling

  • Script failures can trigger toast feedback
  • onError hooks can execute fallback actions
  • throwError can intentionally halt save/action chains with user-facing messages
See ScriptButton and SaveButton for component-specific details.

Form components

Reference for Caseflow form and field components — EditableField, RelatedObject, RelatedDocument, RelationPicker, and utility components.