Template functions are already predefined functions that can be used to ease the use of tokens. These functions can be used in places where you are allowed to use tokens, like email, push notification templates.
These functions cannot be used in collection aggregates even though you are allowed to use tokens there.
The following shows all of the available functions.
These functions help to work with dates, such as converting milliseconds to date string and other.
// Takes in milliseconds as a number or string and a format.// Returns formatted date stringstring UnixTimeToDateString(long? ms, string format = "yyyy-MM-dd") {...}string UnixTimeToDateString(string ms, string format = "yyyy-MM-dd") {...}
// Safe way to get a property// Returns a property by name, or null if not founddynamic GetProperty(dynamic obj, string name) {...}
The following shows how to use these functions. Example is taken from email template.
<h1>Welcome to project @Model.Project.Name.</h1>​<p>Current date: @UnixTimeToDateString(@Model.DateMillis, "dd/MM/yyyy")</p>