When a template doesn't work
What to check when a template prints nothing, prints the wrong value, or makes a step fail.
| What you see | Cause | What to do |
|---|---|---|
| A value prints nothing | The name is misspelt, or the value isn't set for this alarm. A template doesn't report unknown names. | Print the parent with dump(), for example {{ dump(device) }}, and check the exact name. Add a fallback with the default filter. |
| A step result prints nothing or a number | The Step Reference contains a dash or starts with a digit: {{ my-step.answer }} is read as a subtraction. |
Use a reference of letters, digits and _, starting with a letter, for example myStep. |
| A header prints nothing or a number | The header name contains a dash and is written with dots. | Use brackets: {{ alarm.headers['x-receiver'] }}. |
| A result shows the last run only | A step that runs several times in one workflow keeps only its latest result. | Give each run its own step, or read executionCount to see how often it ran. |
| The step fails with "Could not resolve environment variable(s)" | The variable doesn't exist, is disabled, or is a secret used outside the Trigger Web Hook step. | Check it in Company Settings › Environment Variables. Use secrets only in Trigger Web Hook. |
An SMS or call text contains {{ env('NAME') }} literally |
The variable couldn't be resolved, so the text went out unfilled. | As above. |
The step fails after toInt, toLong or toFloat |
The value isn't a number. | Check the value with dump(), or test it first: {% if value is not empty %}. |
| A date shows the wrong time | The time zone was passed as the second argument of date, which is the input format. |
Name it: date('HH:mm', timeZone='Europe/Zurich'). |
| A decoded value prints as a list of numbers | decodeBase64 and decodeHex give bytes. |
Add the toString filter after it. |
| Unwanted empty lines | Line breaks around {% %} blocks are kept. |
Put the block on the same line as the text around it. |
{{ dump() }} prints null |
dump needs a value. |
Name what to print: {{ dump(alarm) }}. |
Templates in webhooks
In the field mapping of an incoming webhook, a template that renders empty is ignored. A template that fails writes its error message, or ERROR, into the alarm field. If an alarm from a webhook shows an odd value, check the template of that field.
Placeholders in an alarm expression
The Alarm Expression of a Trigger Alarm step is filled in before it is used, but the editor checks the text as you typed it. A placeholder can therefore show the expression as invalid even though it works. It only fails if the filled-in value breaks the expression, for example a value with a comma or a brace.
See what a step really sent
The workflow simulator (Test Workflow) can't run automated steps. To see the real text, run the workflow on a test alarm or a site in test mode, then read the step's log in the alarm's workflow.