Variable Reference
This page provides a complete reference for all variables and Handlebars helpers available in epilot templates.
Variable Syntaxโ
Variables use Handlebars syntax with double curly braces:
Entity Variablesโ
Access entity data using the entity slug as a prefix:
| Syntax | Description |
|---|---|
{{contact.first_name}} | Contact's first name |
{{order._title}} | Order title |
{{opportunity.billing_address}} | Opportunity's billing address |
{{_title}} | Title of the main entity in context |
Nested Attributesโ
Access nested attributes with dot notation:
Computed Metadata Fieldsโ
Some fields store IDs that are resolved to human-readable values using the :<field> suffix:
System Variablesโ
| Variable | Description |
|---|---|
{{system.date}} | Current date (formatted for the org locale) |
{{system.time}} | Current time |
Environment Variablesโ
Reference organization-level environment variables in templates using the {{ env.* }} prefix. Environment variables are resolved at runtime, allowing the same template to work across sandbox and production environments.
Using Environment Variables in Templatesโ
Environment variables are supported anywhere template variables work:
Email subject:
Email body:
<p>
View your order in the
<a href="https://{{env.portal.domain}}/orders">customer portal</a>.
</p>
Document templates:
tip
Use Environments & Secrets to manage your organization's environment variables. Variables set there can be referenced with {{ env.key }} in any template.
Variable Typesโ
| Type | In Templates | In Webhooks |
|---|---|---|
| String | Yes | Yes |
| SecretString | No | Yes |
SecretString values are only available in trusted backend contexts (webhooks, integrations) and are never exposed in user-facing templates.
For full details on creating and managing environment variables, see Environments & Secrets.
Organization Variablesโ
| Variable | Description |
|---|---|
{{organization.name}} | Organization name |
{{organization.website}} | Organization website URL |
{{organization.email}} | Organization email |
{{organization.phone}} | Organization phone number |
{{organization.address}} | Full formatted address |
{{organization.signature}} | Email signature |
User Variablesโ
| Variable | Description |
|---|---|
{{user.display_name}} | Current user's display name |
{{user.email}} | Current user's email |
{{user.phone}} | Current user's phone number |
{{user.department}} | Current user's department |
Portal & Link Variablesโ
| Variable | Context | Description |
|---|---|---|
{{consent.optInLink}} | Double opt-in confirmation link | |
{{unsubscribe_url}} | Unsubscribe link | |
{{portalUser.confirmationLink}} | Portal user email confirmation link | |
{{portalUser.forgotPasswordLink}} | Portal password reset link | |
{{customerPortal.invitationLink}} | Customer portal invitation link | |
{{installerPortal.invitationLink}} | Installer portal invitation link | |
{{customerPortal.newDocumentLink}} | Link to new document in customer portal | |
{{customerPortal.entityLink}} | Link to entity in customer portal | |
{{customerPortal.userEmailsOnEntity}} | Portal user emails associated with the entity |
Handlebars Helpersโ
Standard Library Helpersโ
All helpers from handlebars-helpers are available, including:
- math:
add,subtract,multiply,divide,ceil,floor,round,abs - number:
bytes,addCommas,toFixed,toPrecision - comparison:
eq,ne,lt,lte,gt,gte,and,or,not - array:
first,last,after,before,join,sort,length,map,filter - string:
capitalize,lowercase,uppercase,trim,truncate,replace,split - date:
moment(Moment.js formatting) - object:
get,keys,values,extend,merge - url:
encodeURI,decodeURI,urlResolve,urlParse
Address Helpersโ
formatAddressโ
Formats an address object into a single-line string.
addressโ
Formats the primary address from context (searches for billing or primary tags).
billing_addressโ
Formats the billing address (searches for billing, shipping, or primary tags).
shipping_addressโ
Formats the shipping address (searches for shipping, billing, or primary tags).
delivery_addressโ
Formats the delivery address (searches for delivery or primary tags).
additional_addressโ
Formats an additional address tagged as primary.
Contact Helpersโ
emailโ
Retrieves the email address, prioritizing email then billing_email.
billing_emailโ
Retrieves the billing email, prioritizing billing_email then email.
phoneโ
Retrieves the phone number, prioritizing phone then billing_phone.
billing_phoneโ
Retrieves the billing phone, prioritizing billing_phone then phone.
Date & Time Helpersโ
formatDateโ
Formats a date string. Defaults to dd.MM.yyyy.
formatDateTimeโ
Formats a date/time string. Defaults to dd.MM.yyyy HH:mm.
dateMathโ
Performs date arithmetic.
Parameters:
inputDate- The starting dateexpression- Arithmetic expression like+1d,-2w,+1MinputFormat(optional) - Input date formatformat(optional) - Output date format
Expression units: d (days), w (weeks), M (months), y (years)
Currency Helpersโ
asCurrencyโ
Formats a number as currency using @epilot/pricing.
Parameters:
amount- The number to formatcurrency(default:EUR) - Currency codelocale(default:de) - Locale for formattingdisplayZeroAmount(default:false) - Show zero amounts
fromCentsโ
Converts a cent value to decimal. Handles both raw integers and formatted strings.
toNumberโ
Parses a locale-formatted number string to a number.
Comparison Helpersโ
gtโ
Returns true if the first value is greater than the second.
ltโ
Returns true if the first value is less than the second.
eqโ
Returns true if two values are equal.
Boolean Helpersโ
ynโ
Converts a boolean value to localized "Yes" or "No".
xifโ
Returns "x" if truthy, empty string if falsy. Useful for checkboxes in documents.
Tag & Filter Helpersโ
withTagโ
Retrieves a value from an array by tag.
Parameters:
arr- Array to searchtag(default:primary) - Tag to matchattribute(optional) - Attribute to extract
Special tags:
*- Get values from all items (comma-separated)...tagname- Get all items matching the tag (spread)
String Helpersโ
padStartโ
Pads a string to a target length with a character.
Journey Link Helpersโ
generateJourneyLinkโ
Generates a signed journey link with optional parameters.
Required:
journey_id- The journey ID
Optional:
custom_url- Custom domain for the URLexpires_in- Token expiration (ms format)nonce- Add a nonce to the payload
Order Table Helpersโ
These helpers are used internally by Order Table Variables.
| Helper | Description |
|---|---|
calculateColspan | Calculates colspan for table cells |
calculatePeriodColspan | Calculates colspan for period columns |
calculateSummaryColspan | Calculates colspan for summary sections |
isColumnEnabled | Checks if a column is enabled |
shouldDisplayDetails | Checks if column details should display |
isSummaryVisible | Checks if summary section is visible |
isExternalFeesMetadataVisible | Checks if external fees are visible |
makeStyle | Converts config to CSS style string |
Excel-like Formulasโ
The calc helper supports Excel-like formulas for calculations.
Arithmetic Operatorsโ
| Operator | Description |
|---|---|
+ | Addition |
- | Subtraction |
* | Multiplication |
/ | Division |
^ | Exponentiation |
% | Modulus |
() | Grouping |
-n | Negation |
Formula Functionsโ
| Function | Description |
|---|---|
ABS(n) | Absolute value |
AND(a, b, ...) | Logical AND |
AVERAGE(a, b, ...) | Average of values |
CEIL(n) | Round up |
FLOOR(n) | Round down |
IF(cond, t, f) | Conditional |
MAX(a, b, ...) | Maximum value |
MIN(a, b, ...) | Minimum value |
NOT(a) | Logical NOT |
OR(a, b, ...) | Logical OR |
ROUND(n, places) | Round to decimal places |
SUM(a, b, ...) | Sum of values |
RAND() | Random number 0-1 |
Date Functionsโ
All date functions work with ISO 8601 strings and use UTC by default.
| Function | Description |
|---|---|
NOW([tz]) | Current datetime |
TODAY([tz]) | Current date |
DATEADD(date, val, unit, [tz]) | Add/subtract time |
DATEDIFF(start, end, unit, [tz]) | Difference between dates |
YEAR(date, [tz]) | Extract year |
MONTH(date, [tz]) | Extract month (1-12) |
DAY(date, [tz]) | Extract day (1-31) |
HOUR(date, [tz]) | Extract hour (0-23) |
MINUTE(date, [tz]) | Extract minute (0-59) |
SECOND(date, [tz]) | Extract second (0-59) |
WEEKDAY(date, [type], [tz]) | Day of week |
WEEKNUM(date, [type], [tz]) | Week number |
DATEADD units: years, quarters, months, weeks, days, hours, minutes, seconds
Where Variables Are Supportedโ
| Feature | Variables | Environment Variables | Secrets |
|---|---|---|---|
| Email templates | Yes | Yes | No |
| Document templates | Yes | Yes | No |
| Webhooks | Yes | Yes | Yes |
| Automation actions | Yes | Yes | Yes |
| Entity mapping | Yes | Yes | Yes |
| Journey configurations | Yes | Yes | No |
| Customer Portal | Yes | Yes | No |
| ERP integrations | Yes | Yes | Yes |
note
Secrets (SecretString environment variables) are only available in trusted backend contexts like webhooks and integrations. They are never exposed in templates or the frontend.