For non-aggregate query alerts, the fields from the table are all available for field substitution in alert messages. For aggregate query alerts, you can only reference fields that are aliased to aggregate expressions you have specified, plus any grouped-by field names. For cron alerts, there is no tuple on which to substitute fields.
- Simple Field Names
For a non-aggregate query alert, alert messages can be similar to the following:
Running low on $Item in $category
This alert message substitutes the values of the
categoryfields from the row in the data table that triggers the alert.
- Group-By Fields
If a table query contains a group-by clause, the names of the grouped-by field or fields are always available for field substitution expressions in alert rule messages.
- Multiple Aggregate Expressions
If you have multiple aggregate expressions in the aggregate alert condition, specify an alias for one of the aggregate expressions to the exact field name
LVAlertTestExpression, with that exact spelling. This aggregate expression must resolve to the boolean data type. The alert is fired when the condition in this expression is met, and transitions from
Other aggregate expressions in the same query are calculated, but are ignored for the purpose of firing the alert. It is a best practice providing reasonable field name aliases for these other aggregate expressions, using names that do not conflict with actual field names in the underlying data table.
When the alert fires based on the expression aliased to
LVAlertTestExpression, the additional aggregate expression values in the same query can be referenced in field substitution expressions in messages, emails, or other alert rule actions.
For example, consider the following aggregation condition:
avg(lastSoldPrice) > lastval(lastSoldPrice) as LVAlertTestExpression, lastval(quantityRemaining) as QtyRemaining, lastval(Item) as LastItem
This allows an alert rule message like the following:
Price is dropping on $LastItem and only $QtyRemaining are left in stock.
The following lists the alert rule metadata variable names you can use to substitute into your alerts.
AlertRule.GUID AlertRule.MessageTemplate AlertRule.Name AlertRule.Description AlertRule.Severity AlertRule.Owner AlertRule.Created AlertRule.ID AlertRule.Table AlertRule.Predicate AlertRule.Delay AlertRule.Payload
Use the following format to substitute system properties into your alerts.
PROP.liveview.project.home PROP.liveview.project.out PROP.version
For security purposes, all system properties aside from version must be on a white list configured via
liveview.alert.sysprop.whitelist. The default properties are
liveview.project.home;liveview.project.out. You can add your own semicolon-separated list of system properties to the white list.