HELPGETTING STARTED

Using conditional text blocks in an automated email

Using variables in your emails allows you to personalize your messages. And using tags and filters on email templates allows you to create completely different emails for different groups. But sometimes you want something that's somewhere in between. Not just replacing one word, but also not sending a completely different email. That's where conditional text blocks come in handy.

Let's say you want to send pretty much the same 'before your first day' email to all new hires, but you want to include an additional paragraph when the person is joining the engineering team.

Now, you could have two separate email templates and use filters to send one to anyone who doesn't have the engineering tag and the other to everyone who does. But then when you need to make small changes to the text of the standard email, you've gotta remember to do it in two places.

Conditional text blocks allow you to include different text, without having to manage multiple templates for the same email.

What it looks like

They look like this:

{{#ifEqual officeLocationField "Spain"}}
¡Bienvenidos, {{ Preferred first name }}!
{{else}}
Welcome {{ Preferred first name }}!
{{/ifEqual}}

The components

It opens with a  line of logic

{{#ifEqual officeLocationField "Spain"}}

The first line is wrapped in curly brackets – {{ }} – and includes: a method, the employee data you're checking, and the text you're checking to see if the data does or doesn't match.

They start with one of two methods: ifEqual and ifNotEqual

Then they reference either a field or a survey response, using the format [camelCaseName]Field or [camelCaseName]SurveyResponse.

So if you're trying to reference a "Office Location" employee field it would be written "officeLocationField"

If you're trying to reference a "Remote employee" survey response it would be written "remoteEmployeeSurveyResponse".

And then the opening line finishes with the text you're checking the data for.

Under that line is the text you want to dynamically include for people who match the criteria, including any employee variables.

¡Bienvenidos, {{ Preferred first name }}!

Next you have the option of including alternative text for anyone who doesn't meet the logic criteria.

{{else}}
Welcome {{ Preferred first name }}!

And finally close the conditional text block method.

{{/ifEqual}}