Open navigation

Getting started with the template editor

The template editor allows you to design your signatures, campaigns and disclaimers for both HTML and Plain text email. You can also preview your templates with user data for any selected user. This article tells you how to get started with the editor, how to use merge fields, and how to use conditional statements.

Getting started

The template editor is designed to be easy to use and to allow creating templates without any coding experience:

The top ribbon allows switching between the HTML and Text templates. When in HTML mode you can switch between the Visual Editor, the Source Editor and Preview, and when in Text mode, you can switch between the Source Editor and Preview. Preview allows you to preview the template as it will look in email clients merging with data for a selected user.

Below the top ribbon there is a menu, and also a toolbar, providing you access to all the commands of the editor. Editing and using commands will be familiar to users of most email clients and word processing software.

When creating templates you use merge fields to merge user data such as full name, job title and phone numbers. You can also use conditional statements to control the design depending on if fields are empty or match certain criteria. Finally can use functions and code to manipulate data. For example you can convert data to lower case or upper case. You can find more information on all of this below.

Merge fields

The following merge fields are supported in templates:

NameMerge field
Company{{Company}}
Department{{Department}}
Email{{Email}}
First name{{FirstName}}
Last name{{LastName}}
Full name{{FullName}}
Job title{{JobTitle}}
Mobile{{Mobile}}
Office{{Office}}
Phone{{Phone}}
Fax{{Fax}}
Street{{Street}}
City{{City}}
State{{State}}
Postal code{{PostalCode}}
Country{{Country}}
Custom attribute{{CustomAttribute1}} to {{CustomAttribute15}}
Photo{{PhotoUrl}}

You can use merge fields anywhere in HTML and plain text templates.

Conditional statements

You can use conditional statements to control the layout of your template depending on user data. This is useful to control the layout, for example, when merge fields are empty.

Check if field is set

{{if Field}}...{{end}}

{{if Field}}...{{else}}...{{end}}

Check if field is not set

{{if !Field}}...{{end}}

{{if !Field}}...{{else}}...{{end}}

Check field against value

{{if Field=="value"}}...{{end}}

{{if Field=="value"}}...{{else}}...{{end}}

The following operators are available for comparing values:

OperatorDescription
<left> == <right>Is left equal to right?
<left> != <right>Is left not equal to right?
<left> > <right>Is left greater than right?
<left> >= <right>Is left greater or equal to right?
<left> < <right>Is left less than right?
<left> <= <right>Is left less or equal to right?

The following operators are available for combining conditional expressions:

OperatorDescription
<left> && <right>Is left true and right true?
<left> || <right>Is left true or right true?

String functions

The table below details some of the supported string functions:

FunctionDescription
string.containsDoes input string contain specified string?

Example:

{{if (string.contains Field "value")}}...{{end}}
string.downcaseConvert string to lower case.

Example:

{{string.downcase Field}}
string.replaceReplaces all occurrences of a string with a substring.

Example:

{{string.replace Field "match" "replace"}}
string.sliceReturns the substring starting at the specified index and optionally with a specified length.

Example:

{{string.slice Field start length}}
string.upcaseConvert string to upper case.

Example:

{{string.upcase Field}}

Avoiding blank or empty lines

When a conditional statement that evaluates to false includes a whole line this will result in a blank line in the signature. To avoid this, include the line break within the conditional statement. 

The example below results in an empty field between name and phone in signatures for users that do not have a mobile number:

{{fullname}}
{{if mobile}}Mobile: {{mobile}}{{end}}
Phone: {{phone}}

To avoid this scenario, the conditional statement should be rewritten to include the line break as the example below:

{{fullname}}
{{if mobile}}Mobile: {{mobile}}
{{end}}Phone: {{phone}}

 

Coding

We support the scriban language in templates. Scriban is a fast, powerful, safe and lightweight scripting language. You can use this for example to convert phone numbers to a specific format. The full documentation is available here:

https://github.com/scriban/scriban/blob/master/doc/language.md

Did you find it helpful? Yes No

Send feedback
Sorry we couldn't be helpful. Help us improve this article with your feedback.