Knowledge Base

  1. Home
  2. Knowledge Base
  3. Message Setup
  4. Message Templates
  5. Conditional Logic

Conditional Logic

Conditional logic can be used in your message templates and appointment pages to include or exclude certain parts of the message.

For example, if you want include a special message for appointments that are after 5pm, your message template could be:

Appointment Reminder:  This is your reminder for your appointment {{ event.day_and_time_phrase }}.  {% if event.time_hour >= 17 %}Please note that the office closes promptly at 6pm.{% endif %}

This setup will include the “Please note that the office closes promptly at 6pm” ONLY in messages to appointments that start after 5pm

Syntax

Conditional logic is in the following format:

{% if CONDITION %} CONTENT {% endif %}

or

{% if CONDITION %} CONTENT {% else %} ALTERNATE {% endif %}

or

{% if CONDITION %} CONTENT {% elsif CONDITION2 %} CONTENT2 {% endif %}

 

Conditions

Conditions are in the format

FIELD OPERATOR OPERAND

or for boolean fields, you can test if a field is true by just putting

FIELD

 

Operators

Operator Description
== Exact equals. For example, for boolean fields, ‘participant.first_appointment_of_the_day true’ would be true if the appointment was the first appointment of the day. Or ‘event.all_day false’ would be true if the appointment was not an all day appointment
!= Is not equal. For example, participant.confirmed != true would be true if the participant had not confirmed.
> Greater than. Useful for number fields. e.g. if event.time_hour > 12 would be true if the appointment was in the afternoon.
>= Greater than or equal. Useful for number fields.
< Less than. Useful for number fields.
<= Less than or equal. Useful for number fields.
includes String includes a certain word or phrase. e.g. if event.title includes 'rain'. Includes is not case sensitive and only matches words by themselves (i.e. it would not match “raindrop”, but it would match “time for rain”)
does_not_include String does not include a certain word or phrase.
contains String contains a certain string. Not case sensitive. Matches any string, even if the string is inside another string. e.g. if event.title contains 'rain' would match “raindrops”
does_not_contains String does not contain a certain string.
starts_with String starts with a specific string. Not case sensitive. If the keyword were pump, it would match the selected field if it were pumpkin.
does_not_start_with String does not start with a specific string. Not case sensitive.
ends_with String does ends with a specific string. Not case sensitive. If the keyword here were kin, it would match the selected field if it were pumpkin.
does_not_end_with String does not end with a specific string. Not case sensitive.

Boolean Operators

Boolean operators can be used to generate complex logic, e.g.

{% if event.title starts_with 'call:' and event includes 'conference' %}Please use the conference line provided to join the conference.{% endif %}
Operator Description
and Condition A and Condition B
or Condition A or Condition B