ui.widget
ui.widget automations allow custom output to be implemented for card, profile, or workspace widgets. This replaces bot behavior-based widgets, which are now deprecated.
This trigger uses event handler KATA, and the first enabled automation is executed.
Inputs
The automation dictionary starts with the following values:
| Key | Type | Notes |
|---|---|---|
inputs |
dictionary | Custom input values from the caller |
record_* |
record | The current record dictionary (supports key expansion). Only available on card and profile widgets. |
widget_* |
record | The card, profile, or workspace widget record (supports key expansion) |
worker_* |
record | The current worker record (supports key expansion) |
Outputs
return:
| Key | Type | Notes |
|---|---|---|
html |
text | The HTML to render for the widget |
Example
A workspace widget that greets the current worker and prints the number of tickets they're watching.
-
On the Automation widget, select the Automation toolbar button and bind the widget to the automation by URI:
automation/greeting: uri: cerb:automation:example.dashboard.greeting disabled@bool: no inputs: title: Welcome backThe first enabled handler wins, so the same widget can switch between automations based on role, dashboard prompts, or any other condition.
-
inputs: text/title: default: Welcome required@bool: no start: data.query/watched: output: watched inputs: query@text: type:worklist.metrics values.count:( of:ticket function:count field:id query:( watchers:(id:{{worker_id}}) status:o ) ) format:table return: html@text: <h3>{{inputs.title}}, {{worker_first_name}}.</h3> <p>You're watching <b>{{watched.data.rows|first.value}}</b> open tickets.</p>The automation receives
worker_*andwidget_*placeholders automatically. The returnedhtmlis rendered inline in the widget's zone – styles can come from inline CSS, the dashboard's stylesheet, or Cerb's built-in classes. -
The automation's policy must allow
data.query, otherwise the call is blocked when the widget renders. Scope the allow to the specific query type the automation needs:commands: data.query: deny/type@bool: {{query.type != 'worklist.metrics'}} allow@bool: yesThe
denyrule fires first – any query whosetype:is notworklist.metricsis rejected before theallowis considered.