TracCloud: Twig: Difference between revisions
From Redrock Wiki
No edit summary |
No edit summary |
||
| Line 241: | Line 241: | ||
|- | |- | ||
| Student.Full_Name2 || The student’s full name, formatted as “First M. Last” | | Student.Full_Name2 || The student’s full name, formatted as “First M. Last” | ||
|- | |||
| Student.FirstLast || Student's full name, formatted as "First Last" | |||
|- | |||
| Student.LastFirst || Student's full name, formatted as "Last, First M" | |||
|- | |- | ||
| Student.Home_Phone || Student's home phone number | | Student.Home_Phone || Student's home phone number | ||
| Line 272: | Line 276: | ||
| Student.Grad_Und || Student's undergraduate | | Student.Grad_Und || Student's undergraduate | ||
|- | |- | ||
| Student. | | Student.GPA || Student's GPA | ||
|- | |- | ||
| Student.CustomData.cf_0 || Custom fields, hover over each field in the Email Tag list to find the correct tag | | Student.CustomData.cf_0 || Custom fields, hover over each field in the Email Tag list to find the correct tag | ||
| Line 286: | Line 288: | ||
|- | |- | ||
| Appointment.EndDT || Appointment end day/time, formatted as "2020-01-31 15: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.Fund || Appointment fund choice | ||
| Line 291: | Line 295: | ||
| Appointment.Location || Appointment location choice | | Appointment.Location || Appointment location choice | ||
|- | |- | ||
| Appointment.Online || If the appointment is online, this tag will display as "1", otherwise it will be blank. | | Appointment.Online || If the appointment is online, this tag will display as "1", 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-31-01 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.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. | ||
| Line 302: | Line 314: | ||
|- | |- | ||
| Appointment.EndDate || Appointment end date, formatted as "01/31/20" | | 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.isCancelled || Cancelled status, displayed as 'true' or 'false' | ||
|- | |||
| 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.isRecurring || Recurring status, displayed as 'true' or 'false' | ||
|- | |||
| Appointment.recurFirstDate || The first date of a recurring appointment series, formatted as "2021-31-01" | |||
|- | |||
| Appointment.recurLastDate || The final date of a recurring appointment series, formatted as "2021-31-01" | |||
|- | |- | ||
| Appointment.Status || The appointment status. | | Appointment.Status || The appointment status. | ||
|- | |- | ||
| Appointment.DisplayTime || Appointment time, formatted as "200p" (minutes will display noticeably smaller than hours) | | 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.DisplayDate || Appointment date, formatted as "Fri, Jan 31" | ||
| Line 316: | Line 342: | ||
|- | |- | ||
| 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.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 | | Appointment.CustomData.cf_0 || Custom fields, hover over each field in the Email Tag list to find the correct tag | ||
| Line 373: | Line 401: | ||
|- | |- | ||
| Faculty.Salutation || Faculty member salutation, for example, "Dr." | | Faculty.Salutation || Faculty member salutation, for example, "Dr." | ||
|- | |||
| Faculty.Department || Faculty's department | |||
|- | |- | ||
| Faculty.Phone || Faculty's phone number | | Faculty.Phone || Faculty's phone number | ||
| Line 387: | Line 417: | ||
{| class="wikitable" | {| class="wikitable" | ||
|+ Consultant | |+ Consultant <i>("Consultant." or "Staff." prefixes can be used interchangeably)</i> | ||
|- | |- | ||
| Consultant.First_Name || Consultant's first name | | Consultant.First_Name || Consultant's first name | ||
| Line 402: | Line 432: | ||
|- | |- | ||
| Consultant.Phone || Consultant's phone number | | Consultant.Phone || Consultant's phone number | ||
|- | |||
| Consultant.Pronouns || Consultant's preferred pronouns | |||
|- | |||
| Consultant.Photo<nowiki>|raw</nowiki> || Consultant's photo | |||
|- | |||
| Consultant.StaffBIO<nowiki>|raw</nowiki> || Consultant's bio | |||
|- | |- | ||
| Consultant.WorkPhone || Consultant's work phone number | | Consultant.WorkPhone || Consultant's work phone number | ||
| Line 435: | Line 471: | ||
|- | |- | ||
| Visit.EndDate || End date of visit, formatted as “04/05/21” | | 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.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 | | Visit.CustomData.cf_0 || Custom fields, hover over each field in the Email Tag list to find the correct tag | ||
|} | |||
{| class="wikitable" | |||
|+ Documents (only for document emails) | |||
|- | |||
| Document.OrigName || The file name (including file extension). | |||
|- | |||
| Document.Notes || Notes entered during document upload. | |||
|- | |||
| Document.PostedBy || The user who uploaded this document. | |||
|- | |||
| Document.Usage || Where this document was uploaded, e.g., Appointment, Student, Availability. | |||
|- | |||
| DocType.Name|| The document type selected during upload. | |||
|} | |} | ||
Revision as of 19:09, 30 November 2022
|
Formatting Text in TracCloud with Twig and HTML
Many text boxes throughout TracCloud support Twig, this allows greater control in determining how emails are formatted and what data is included. HTML is also supported, allowing to you adjust the formatting of text. From font sizes, colors, and types, to embedding images and video.
TagsEmail tags can be used to pull data from various TracCloud fields to be included in emails and upcoming appointments. Many of the Twig examples in this chapter will be using these tags, whether they’re used as part of a Twig command or just offhandedly included in an unrelated part of the email. A list of tags can be found at the bottom of this chapter (and within the TracCloud menu), but for a basic primer on how these tags can be used in isolation, here’s an example of a confirmation email. Hello, {{Student.First_Name}}
<br><br>
Your {{Appointment.OnlineText}} appointment with {{Consultant.FirstLast}} at
{{Appointment.StartTime}} for {{Course.SubjectCourse}} has been scheduled. If you have any
questions prior to your appointment, feel free to reach out to {{Consultant.Email}}
<br><br>
Your appointment can be joined here: {{Appointment.OnlineLink}}
<br><br>
Regards, {{Center.Name}}
When this email is sent, all the tags we included are replaced with the relevant information for this appointment.
ifif statements will likely be the most commonly used Twig command for most use-cases. This allows you to write out statements such as “if the student selected reason “Exam Help,” then include this piece of text.” Or in the example below, if the appointment is online, include text to specify this.
Hello {{Student.First_Name}},
<br><br>
{% if Appointment.Online == "Online" %}
This is an online appointment.
{% endif %}
<br><br>
Please be ready for the appointment at the time you selected.
If the if statement is true, all text up to the endif line will be printed in the email. Since the appointment this student booked is online, the “This is an online appointment” text was included. Otherwise, it would jump straight to “Please be ready for the appointment…”
{% if Course.Subject starts with "Chem" %}
this text is only included if our subject starts with “Chem”. This is case-sensitive.
{% endif %}
{% if Course.Subject ends with "101" %}
This text is only included if our subject ends with “101”
{% endif %}
{% if Appointment.Online != "Online" %}
This text is only included if the appointment is not online
{% endif %}
{% if Course.Subject == "Math" or Course.Subject == "Chem" %}
This text is only included if the subject is Math or Chem
{% endif %}
{% if (CalcMissedAppointments(Student.Sequence, Center.ProfileID) > 0) %}
You have {{CalcMissedAppointments(Student.Sequence, Center.ProfileID)}} missed
appointments since {{CalcMissedDate(Center.ProfileID)}}.
{% endif %}
elseAn else statement allows us to include a block of text or an additional instruction if an if statement ends up not being true. For example, if our appointment above turns out to be an in-person appointment, maybe we want to include a different string of text. Hello {{Student.First_Name}},
<br><br>
{% if Appointment.Online == "Online" %}
This is an online appointment.
{% else %}
This is an in-person appointment.
{% endif %}
<br><br>
Please be ready for the appointment at the time you selected.
Since the appointment wasn’t online, we get the “This is an in-person…” text in our confirmation email instead.
elseifAn elseif statement allows us to ask additional if questions, assuming the answer to the prior question was No. Hello {{Student.First_Name}},
<br><br>
{% if Course.Subject == "Math" %}
This appointment is for Math
{% elseif Course.Subject == "Chem" %}
This appointment is for Chem
{% endif %}
<br><br>
Please be ready for the appointment at the time you selected.
Since our appointment was for Chemistry, we receive the following email. If the appointment was for neither Chemistry nor Math, we wouldn’t see a middle block of text at all.
if (for arrays)When you want to use an if statement for arrays, such as the Reasons and Recommendations for SAGE referrals, the formatting is a little bit different. In this context, you would want to know if the Reasons array contains the reason you’re looking for. This would be formatted as such: Hello {{Student.First_Name}},
<br>
{% if "Poor Grades" in Reasons %}
This referral is being submitted due to the reason “Poor Grades”
{% endif %}
Since “Poor Grades” was the reason our faculty member selected when submitting this referral, we receive the following email.
{% if "Poor Grades" not in Reasons %}
This referral was *not* created with the reason “Poor Grades”
{% endif %}
for (listing sequence contents)The for command allows us to list out the contents from a specific sequence. This would frequently be used for listing out Reasons or Recommendations in SAGE referral emails. This referral is being submitted because of these reasons:
<br>
{% for key,value in Reasons %}
{{ value }} <br>
{% endfor %}
<br><br>
And these recommendations:
<br>
{% for key,value in Recommendations %}
{{ value }} <br>
{% endfor %}
File:6j57k6jthngfbv.png
{% for item in ReferralType.Reasons %}
{{ item.value|e }}
{% endfor %}
SAGE QuestionsCustom questions within SAGE have one more moving part to take into consideration. When creating a custom question, there’s a field named “Code Reference.” This is the code used when referring to this question in emails and reports.
Hi, this referral has been submitted:
<br><br>
{% if Answers.VisitQuestion != '' %}
You answered {{Answers.VisitQuestion}} to the question {{Questions.VisitQuestion}}
{% endif %}
<br><br>
{% for key,value in Answers %}
The answer to question {{ attribute(Questions, key) }} is {{ value }}
<br>
{% endfor %}
First, we’re looking for a specific question and answer. To pull this information, we’re using the tags “Answers.[Code Reference]” and “Questions.[Code Reference]”, with the code reference portion being replaced with whatever we entered in the SAGE custom question. If this question was answered, we’re going to include our answer and the question itself in the email.
Actions (for SAGE)Actions can be used as commands in addition to Twig. At this time, the only Action that has been implemented is #ACTION:DO NOT SEND#, which prevents the email from being sent. This would be useful in situations where not all of your SAGE referrals need to result in an email being sent. For example, you could have a dedicated recommendation for “No recommendations at this time”, and we could use that to determine whether or not an email gets sent. {% if "No recommendations at this time" not in Recommendations %}
This referral is being submitted because of these reasons:
<br>
{% for key,value in Reasons %}
{{ value }} <br>
{% endfor %}
<br><br>
And these recommendations:
<br>
{% for key,value in Recommendations %}
{{ value }} <br>
{% endfor %}
{% else %}
#ACTION:DO NOT SEND#
{% endif %}
With this email configuration in place, if our faculty member submits a referral with the recommendation “No recommendations at this time,” no email would be sent. An email will only be sent if that recommendation wasn’t selected, which would then follow the rest of the example above, listing out reasons and recommendations. Tag ListThe remainder of this chapter will display all of the email tags available in TracCloud with definitions.
| |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||




