TracCloud: Twig

From Redrock Wiki

Formatting Text in TracCloud with Twig and HTML

Many text fields throughout TracCloud support Twig and HTML, giving you greater control in determining what data is displayed to your users based on the context of appointments, visits, and more, as well as formatting that data to be as clear as possible.

Twig will be the primary focus of this article. Twig is a template engine that serves two primary purposes in TracCloud:

  • 1. Print variables in text
Personalize your emails and messages. Greet the student by name, let them know what subject they selected in their appointment, what time their appointment takes place, the location, and more. These same variables are also used for purpose #2.
  • 2. Add logic to your text
Modify the email or message based on why it was sent. Add an extra paragraph if X center was selected, send a follow-up email after a visit if the student chose Y, prevent an email from being sent on a SAGE referral if Z recommendation was checked, and much more. Rather than creating a generic email for any context, create an email that formats itself to match the current context.

Twig (and HTML) are supported in profile emails, welcome messages, email templates, appointment display, and more. Most of the examples listed in this article are for appointment emails or SAGE referrals, but the same concepts apply in all other supported fields. It's also worth keeping in mind that Twig exists outside of TracCloud, and there are many resources online for how you can utilize it that will also work here. This guide likely covers everything you will need, but it doesn't cover everything Twig is capable of.

HTML will also be used throughout this article, but without much explanation as it's more ubiquitous than Twig. There are many excellent resources online explaining how to use this markup language, such as W3Schools. HTML is used to adjust font sizes and colors, embed images and videos, and more.


What are Twig tags?

if / if X then do Y

else / if X then do Y, otherwise do Z

elseif / if W then do X, otherwise if Y then do Z

if (arrays) / if X in Y

for (arrays) / for each X in Y, do Z

SAGE Questions & Actions

Tag List

The remainder of this chapter will display all of the email tags available in TracCloud with definitions.

For most of these tags, you can print the relevant value by surrounding the field with double-curly brackets, as seen in several of the above twig examples. The curly brackets are not required when using the value in an if statement, for example.


Student tags

Appointment & Availability tags

Center & Reason tags

Section, Course, & Faculty tags

Consultant/Staff tags

Visit tags

Document tags

Resource tags

SurveyTrac tags

Custom Field tags

SAGE tags

Success Plan tags

Work Plan tags

Workshop tags

Other tags