Home > Reference Material > Template Variables

Template Variables

Template variables are simply expression variables that are preceded by a dollar sign.

For example: $Incident.Client.Site.Zip_Code, where Incident is a stream data component, Client is a smart object, Site is a smart object that contains records related to the client, and Zip_Code is a field in the referenced record.

 

Using Template Variables 

Template variables can be used in:

Hiding Empty Variables

Template variables are processed by the Velocity processing engine. In that engine, when a variable does not have a value, the variable name is displayed.

 

That mechanism aids development and debugging, because it is easy to see what variable is supposed to have data, when data is missing. But there are times when a field may well be empty, and you want to include it the value only when it isn't. For example, you may want to include an optional comment-field in a message, but do not want $Incident.Comment appearing in the message when the comment field is empty.

 

The solution is to prefix the field with $!, rather than $. So in the example just given, the appropriate variable reference would be:

$!Incident.Comment