Skip to main content

Template types

Caseflow templates come in four types:

Template selection

When no explicit templateName is supplied, selection uses class and template type with access-aware resolution:
  1. Group-based match first — user group assignment is evaluated, and the highest-precedence matching template is selected
  2. Default fallback — if no group match exists, the default template is used
If an explicit template name is supplied, that template is fetched directly. See Administration and best practices for template governance details.

Template syntax

Variable resolution

Use {"{{...}}"} for render-time template variables:
The engine supports nested paths using dot notation.

Conditionals

Condition expressions support:
  • Comparisons: ==, !=, >, <, >=, <=
  • Logic: &&, ||, !
  • Grouping with parentheses

Loops

Loop sources can be arrays, comma-separated strings, or objects (iterated as key/value entries).

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
This is why template props can be authored as JSON strings in many component attributes.

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 the data-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:
  • .container inside a template shell expands to 100% width
  • Default container margins are removed inside the shell
This means template authors can use Tailwind layout primitives directly without having to wrap content in a 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

Here {"{{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 a when clause:

Comparison operators

String operators

Unary operators

Logical operators

Combine conditions with and, or, not, or !.

Examples

Workflow transition rule:
Escalation 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 queryKey values in all search components that need external refresh
  • Use throwError in onBeforeSave for business-rule enforcement
Avoid:
  • 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