TracCloud: Twig: Difference between revisions

From Redrock Wiki

No edit summary
No edit summary
 
(4 intermediate revisions by the same user not shown)
Line 319: Line 319:
<hr>
<hr>
<!-------------------------------------------- APPOINTMENT/AVAILABILITY TAGS -------------------------------------------->
<!-------------------------------------------- APPOINTMENT/AVAILABILITY TAGS -------------------------------------------->
<div style="float: left; margin-top: 0em; margin-bottom: 1em"><big><i>Appointment & Availability tags</i></big></div><div class="mw-collapsible mw-collapsed"><br><br>
<div style="float: left; margin-top: 0em; margin-bottom: 1em"><big><i>Appointment & Availability tags</i></big></div><div style="float: right">[[TracCloud:_Rosetta|Moved {{#fas:arrow-up-right-from-square}}]]</div><br>
{| class="wikitable"
|-
| Appointment.StartDT || Appointment start day/time, formatted as "2020-01-31 14:00:00"
|-
| Appointment.EndDT || Appointment end day/time, formatted as "2020-01-31 15:00:00"
|-
| Appointment.Duration || The duration of the appointment, formatted as "60"
|-
| Appointment.Fund || Appointment fund choice
|-
| Appointment.Location || Appointment location choice
|-
| Appointment.Online || Online appointments will be "1", asynchronous will be "2", otherwise it will be blank.
|-
| Appointment.SchedUser || The user type and username of who booked this appointment, formatted as "SysAdmin dsmith"
|-
| Appointment.SchedDT ||  The date and time of when this appointment was booked, formatted as "2020-01-01 13:00:00"
|-
| Appointment.SchedModBy ||  The user type and username of who last modified this appointment, formatted as "SysAdmin dsmith"
|-
| Appointment.SchedModDT ||  The date and time of when this appointment was last modified, formatted as "2020-01-31 13:00:00"
|-
| Appointment.OnlineLink || If the appointment is held online, this tag will create a link that sends students to the room and mark the appointment as attended.
|-
| Appointment.StartTime || Appointment start time, formatted as "02:00pm"
|-
| Appointment.StartDate || Appointment start date, formatted as "01/31/20"
|-
| Appointment.EndTime || Appointment end time, formatted as "03:00pm"
|-
| Appointment.EndDate || Appointment end date, formatted as "01/31/20"
|-
| Appointment.Day || The day of the appointment, formatted as "Wednesday"
|-
| Appointment.isCancelled || Cancelled status, displayed as 'true' or 'false'
|-
| Appointment.OtherNotes || Student cancellation reason.
|-
| Appointment.autoCanceled || Whether or not the appointment automatically cancelled due to max cancel/missed in recurring series rules, displayed as 'true' or 'false'
|-
| Appointment.isMissed || Missed status, displayed as 'true' or 'false'
|-
| Appointment.isRecurring || Recurring status, displayed as 'true' or 'false'
|-
| Appointment.RecurringDates || [Array] Lists all dates of appointments in a recurring series
|-
| Appointment.recurFirstDate || The first date of a recurring appointment series, formatted as "2021-01-31"
|-
| Appointment.recurLastDate || The final date of a recurring appointment series, formatted as "2021-01-31"
|-
| Appointment.Status || The appointment status.
|-
| Appointment.Type || The appointment type, formatted as "1 on 1" or "Group"
|-
| Appointment.Icon<nowiki>|raw</nowiki> || An icon indicating the appointment Type.
|-
| Appointment.DisplayTime<nowiki>|raw</nowiki> || Appointment time, formatted as "200p" (minutes will display noticeably smaller than hours)
|-
| Appointment.DisplayDate || Appointment date, formatted as "Fri, Jan 31"
|-
| Appointment.hasDocument|| Will be 'true' or 'false' depending on whether or not the appointment has a document uploaded. This relies on the permissions of the currently logged in user to determine the value of this tag.
|-
| Appointment.OnlineText || If the appointment is online, this tag will display as "Online", otherwise it will be blank. (for example, "...Your Appointment.OnlineText appointment..." will include or exclude the word "Online")
|-
| Appointment.Link || This provides a link to the appointment record in TracCloud, accessible by students or staff.
|-
| Appointment.CustomData.cf_0 || Custom fields, hover over each field in the Email Tag list to find the correct tag
|}
 
{| class="wikitable"
|-
| AvailBlock.MaxStudents || The max students of an availability block, 1 for one-on-one, greater than 1 for group.
|-
| AvailBlock.isAvail || The type of availability. 0 = Reserve block, 1 = Regular availability, 2 = Stacked availability.
|}
</div>
<hr>
<hr>
<!-------------------------------------------- Center/Reason TAGS -------------------------------------------->
<!-------------------------------------------- Center/Reason TAGS -------------------------------------------->
Line 414: Line 338:
<hr>
<hr>
<!-------------------------------------------- Section TAGS -------------------------------------------->
<!-------------------------------------------- Section TAGS -------------------------------------------->
<div style="float: left; margin-top: 0em; margin-bottom: 1em"><big><i>Section, Course, & Faculty tags</i></big></div><div class="mw-collapsible mw-collapsed"><br><br>
<div style="float: left; margin-top: 0em; margin-bottom: 1em"><big><i>Section, Course, & Faculty tags</i></big></div><div style="float: right">[[TracCloud:_Rosetta|Moved {{#fas:arrow-up-right-from-square}}]]</div><br>
 
{| class="wikitable"
|-
| Section.Code || The section code
|-
| Section.CRN || The section CRN number
|-
| Section.SubjectTermCode || Subject + Section + Term Code, “CHEM321 A2 20202”
|-
| Section.SubjectTitle || Subject + Title, “CHEM321 Chemistry”
|}
 
 
{| class="wikitable"
|-
| Course.Subject || Subject, "CHEM"
|-
| Course.Course || Course, "321"
|-
| Course.Title || Title, "Chemistry"
|-
| Course.SubjectCourse || Subject + Course, "CHEM321"
|-
| Course.SubjectCourseTitle || Subject + Course + Title, "CHEM231 Chemistry"
|}
 
 
{| class="wikitable"
|-
| Faculty.FirstName || Faculty's first name
|-
| Faculty.LastName || Faculty's last name
|-
| Faculty.Salutation || Faculty member salutation, for example, "Dr."
|-
| Faculty.Department || Faculty's department
|-
| Faculty.Phone || Faculty's phone number
|-
| Faculty.Email || Faculty's email address
|-
| Faculty.SalutationFullName || Full name with salutation, for example, "Dr. Phil Roberts"
|-
| Faculty.SalutationLastName || Last name with salutation, for example, "Dr. Roberts"
|-
| Faculty.CustomData.cf_0 || Custom fields, hover over each field in the Email Tag list to find the correct tag
|}
 
</div>
<hr>
<hr>
<!-------------------------------------------- Consultant TAGS -------------------------------------------->
<!-------------------------------------------- Consultant TAGS -------------------------------------------->
Line 499: Line 374:
<hr>
<hr>
<!-------------------------------------------- Visit TAGS -------------------------------------------->
<!-------------------------------------------- Visit TAGS -------------------------------------------->
<div style="float: left; margin-top: 0em; margin-bottom: 1em"><big><i>Visit tags</i></big></div><div class="mw-collapsible mw-collapsed"><br><br>
<div style="float: left; margin-top: 0em; margin-bottom: 1em"><big><i>Visit tags</i></big></div><div style="float: right">[[TracCloud:_Rosetta|Moved {{#fas:arrow-up-right-from-square}}]]</div><br>
{| class="wikitable"
|+ (only for visit emails)
|-
| Visit.EnteredDT || The date and Time the student entered the Center
|-
| Visit.TimeIn || The date and Time the student started receiving help.
|-
| Visit.TimeOut || The date and time the student left the center.
|-
| Visit.Duration || Visit duration in minutes
|-
| Visit.WaitTime || Visit wait time in minutes
|-
| Visit.EnteredTime || Start time of visit, including wait time, formatted as “09:45pm”
|-
| Visit.EnteredDate || Start date of visit, including wait time, formatted as “04/05/21”
|-
| Visit.StartTime || Start time of visit, formatted as “09:48pm”
|-
| Visit.StartDate || Start date of visit, formatted as “04/05/21”
|-
| Visit.EndTime || End time of visit, formatted as “09:48pm”
|-
| Visit.EndDate || End date of visit, formatted as “04/05/21”
|-
| Visit.Day || Day of the visit, formatted as "Wednesday"
|-
| Visit.CtrNotes|| The notes for this visit.
|-
| Visit.CustomData.cf_0 || Custom fields, hover over each field in the Email Tag list to find the correct tag
|}
 
</div>
<hr>
<hr>
<!-------------------------------------------- Document TAGS -------------------------------------------->
<!-------------------------------------------- Document TAGS -------------------------------------------->
Line 589: Line 431:
| ResourceType.Description || The description of the resource type that the resource is assigned to
| ResourceType.Description || The description of the resource type that the resource is assigned to
|}
|}
</div>
<hr>
<!-------------------------------------------- Survey TAGS -------------------------------------------->
<div style="float: left; margin-top: 0em; margin-bottom: 1em"><big><i>SurveyTrac tags</i></big></div><div class="mw-collapsible mw-collapsed"><br><br>
{| class="wikitable"
|-
| Survey.Name || The name of a survey, for use in survey emails. [[TracCloudST|More information.]]
|-
| Survey.Link || A hyperlink to the survey, for use in survey emails. [[TracCloudST|More information.]]
|}
</div>
</div>
<hr>
<hr>

Latest revision as of 22:59, 14 March 2025

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

Custom Field tags

SAGE tags

Success Plan tags

Work Plan tags

Workshop tags

Other tags