Template types
Caseflow templates come in four types:Template selection
When no explicittemplateName is supplied, selection uses class and template type with access-aware resolution:
- Group-based match first — user group assignment is evaluated, and the highest-precedence matching template is selected
- Default fallback — if no group match exists, the default template is used
Template syntax
Variable resolution
Use{"{{...}}"} for render-time template variables:
Conditionals
- Comparisons:
==,!=,>,<,>=,<= - Logic:
&&,||,! - Grouping with parentheses
Loops
Components and HTML
Templates can mix regular HTML tags with registered custom components (capitalized names). Unknown components render as explicit error placeholders.Property parsing and type coercion
Component props are parsed from strings and coerced where possible:- JSON objects and arrays are auto-parsed when valid
"true"/"false"are converted to booleans- Numeric literals are converted to numbers
Template directives
Templates can include HTML comment markers that influence the rendering host’s behavior. These are parsed and stripped before rendering — they do not appear in the rendered output.Directive identifiers are technical literals parsed by the template runtime. They retain the
workview: prefix for backwards compatibility.Example
Template shell and styling
Every Caseflow template renders inside a wrapper element with thedata-workview-template-shell attribute. Inside the shell, the platform applies a small CSS reset so that templates can use standard utility classes like Tailwind’s .container without being constrained by the responsive max-width rules used elsewhere in the application:
.containerinside a template shell expands to 100% width- Default container margins are removed inside the shell
ResponsiveContainer component. The selector name is a technical literal retained for backwards compatibility.
Scope model
Template scope contains two namespaces:
Common values added to scope:
- Regular object attributes
- Stock attributes (
stock.*) - Object metadata (
ObjectId,ClassName) - User context (
user.id,user.username, etc.) - Alias objects registered via
RelatedObject
Render-time vs runtime variables
This is an important distinction:
Rule of thumb:
- Use
{"{{...}}"}for static template composition and default values - Use
${"${...}"}for event-driven logic and action conditions
Runtime variable families
Mixed render-time and runtime example
{"{{stock.objectid}}"} is resolved when the template renders, while ${previousValue} and ${newValue} are resolved when the action executes.
Conditional expressions
Actions can be guarded with awhen clause:
Comparison operators
String operators
Unary operators
Logical operators
Combine conditions withand, or, not, or !.
Examples
Workflow transition rule:Nullish coalescing
Use?? in runtime expressions to guard optional relation data:
Action design guidance
Recommended:- Prefer pipe-delimited action chains for readability:
action1 | action2 | action3 - Keep each action idempotent where possible
- Use explicit
queryKeyvalues in all search components that need external refresh - Use
throwErrorinonBeforeSavefor business-rule enforcement
- Long opaque action chains with no conditional guards
- Writing non-persisted temporary values to normal attributes
- Mixing row-level
${row.*}expressions outside row-driven contexts
