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 awhen clause:
| Category | Operators |
|---|---|
| Equality | ==, != |
| Text | contains, startsWith, endsWith |
| Numeric | gt, lt, gte, lte |
| Empty | isEmpty, isNotEmpty |
| Boolean | isTrue, isFalse |
| Logic | and, or, not |
Runtime variables
Common runtime variables available in action expressions:| Variable | Available in |
|---|---|
${newValue} | onChanged |
${previousValue} | onChanged |
${createdObjectId} | onCreated |
${objectKey} | onCreated |
${selectedObject}, ${selectedObject.Attribute} | RelationPicker onChanged |
${selectedObject.Relation.Attribute} | Nested relation traversal |
${changedFields}, ${oldValues.X}, ${newValues.X} | Save hooks |
${scriptResult}, ${scriptResult.X}, ${scriptError} | Script actions |
${today}, ${now} | All contexts |
${selectedObject.DefaultStatus ?? "New"}
Built-in actions
| Action | Description |
|---|---|
close | Close the current view |
closeWindow | Close the browser window or tab |
refresh:<queryKey> | Refresh an object search component |
refreshDocuments:<queryKey> | Refresh a document search component |
refreshDataset:<queryKey> | Refresh a field dataset |
setValue:{"attributeName":"...","value":"..."} | Set a field value on the current object |
createObject:{"className":"...","attributes":{...}} | Create a new object |
throwError:{"message":"..."} | Halt execution with a user-facing error |
callScript:{"script":"...","inputs":{...}} | Execute a script and chain results |
Practical action patterns
Refresh dependent lists
Capture previous state
Conditional workflow update
Validation gate on save
Scripting
Integration paths
There are three ways to integrate scripts:autofillScriptonEditableField— field-triggered autofillScriptButton— explicit user-triggered executioncallScriptaction — part of an action chain
Script types
Caseflow uses two script types:- workview_autofill
- workview_action
Triggered by field changes. The request context includes:
- Application name
- Class name
- Object ID
- Trigger attribute and value
- Target attribute list
{"values": {...}}) which is applied to the target attributes.ScriptButton vs callScript
- Use
ScriptButtonfor explicit user-triggered operations — “run this script now” - Use
callScriptaction 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
onErrorhooks can execute fallback actionsthrowErrorcan intentionally halt save/action chains with user-facing messages
