The Automated Emails tab allows you to create custom emails that can be sent to one or more of your Potential Email Recipients upon referral submission, follow-up, or completion. Common examples might be an email that is sent to the student when a referral is created for them, with a separate email being sent to an assigned advisor or faculty. The recipients, number of emails, and email contents are up to you.

To create your first Email, click Create New Email, type in your subject line, then click Save. This will add the email to your Automated Emails listing. Click the Pencil Icon for the email you just created, and you should end up at a page like this.

- Email Subject determines the subject line of the email, as you entered previously. This can be changed at any time.
- Email From lets you change which email address this email is sent from. Uses system address if left blank.
- Add Email Recipient allows you to define which users could possibly receive a copy of this email, based on your Potential Email Recipients.
- Email Sends On Referral Action Based Upon Selected Trigger(s) allows you to decide under what context this email is sent. On initial creation, on follow-up, on completion, and on action completed. The first 3 are detailed further in the next portion of this article, the latter is detailed above.
- Email Body is the actual contents of your email.
- If you additionally want to send an SMS message along with this email, choose the recipient and write your message below. The "Consultant" choice will primarily use the consultant linked to the referral. If that field is blank, it will use the student's assigned advisor. If that isn't available, it will send the message to the consultant who created the referral.
One of the key elements of configuring your SAGE emails is Twig, which you can think of as a mini-programming language. Twig plays two key roles, providing tags for the information displayed, and adding logic to your email to determine what content is sent.
A full list of email tags can be found here, but to give a quick example, you could format an email as such:
Hello, {{Student.First_Name}}, this {{ReferralType.Name}} was submitted by {{Faculty.FirstName}}.
Each of those tags would then be replaced by the relevant information when the email is actually sent.
If you wanted to list out the reasons and recommendations that were selected, you would do something like the this. This is because there may be multiple values for reasons and recommendations, while there's only one value stored in Student.First_Name.
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 %}
This is where Twig gets slightly more complicated, but significantly more powerful. Let's say you want to add an extra sentence to your email, but only if a particular reason was selected. In that case, you could write your email like this:
{% if "Poor Attendance" in Reasons %}
Online Tutoring is now available! See example.edu/remote/ for more information.
{% endif %}
That sentence will only be included in the email if that Reason was selected. You may also want to not send the email if a certain condition is met. You can wrap an entire email in an 'if' statement, where the following special action is used which prevents the email from sending.
{% 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 %}
One other factor to consider is custom questions. These can still be used emails, but you will need to use the "Code Reference" value that you set earlier. For example, if your Code Reference was "GradeQuestion1," the format of this tag would be {{Questions.GradeQuestion1}} and {{Answers.GradeQuestion1}} for the question and answer respectively.
The extent of what Twig is capable of is outside the scope of this article. Take a look at our dedicated Twig Guide here, which also includes a list of available tags for students, staff, etc. Additional SAGE-specific tags can be viewed in that article or in the table below.
ReferralType
Sequence |
bigint |
Unique identifer for each referral type. |
|
ReferralType.Sequence
|
Name |
varchar(255) |
The name of the referral type. |
{{ReferralType.Name}} |
ReferralType.Name
|
RosterSubject |
json |
This array contains information about what subject(s) this referral type is linked to. |
|
ReferralType.RosterSubject
|
StudentLinkedListID |
bigint |
Which student list this referral type is limited to, relates to Lists.Sequence. |
|
ReferralType.StudentLinkedListID
|
Active |
tinyint |
Whether or not this referral type is currently active. |
|
ReferralType.Active
|
NotesInstructions |
text |
The contents of the notes instructions field. |
{{ReferralType.NotesInstructions}} |
ReferralType.NotesInstructions
|
Reasons |
json |
An array of all of this referral type's reasons. |
{{ReferralType.Reasons}} |
ReferralType.Reasons
|
Recommend |
json |
An array of all of this referral type's recommendations. |
{{ReferralType.Recommend}} |
ReferralType.Recommend
|
AdditionalNotesInstr |
text |
The contents of the additional notes instrucitons field. |
{{ReferralType.AdditionalNotesInstr}} |
ReferralType.AdditionalNotesInstr
|
OtherInstructions |
text |
The contents of the other instructions field. |
{{ReferralType.OtherInstructions}} |
ReferralType.OtherInstructions
|
Referrals
Sequence |
bigint |
Unique identifer for each referral. |
|
Referrals.Sequence
|
RefTypeID |
bigint |
Which referral type this referral is linked to, relates to ReferralType.Sequence |
|
Referrals.RefTypeID
|
StudentID |
bigint |
Which student this referral is assigned to, relates to Students.Sequence (not Students.ID). |
|
Referrals.StudentID
|
FacultyID |
bigint |
Which faculty this referral is linked to, relates to Faculty.Sequence (not Faculty.UserID). |
|
Referrals.FacultyID
|
SectionID |
bigint |
Which section this referral is linked to, relates to Sections.Sequence. |
|
Referrals.SectionID
|
ConsultantID |
bigint |
Which consultant this referral is linked to, relates to Staff.Sequence. |
|
Referrals.ConsultantID
|
CenterID |
bigint |
Which center this referral is linked to, relates to Centers.Sequence. |
|
Referrals.CenterID
|
CreatedDT |
datetime |
The date and time this referral was created. |
{{Referrals.CreatedDT}} |
Referrals.CreatedDT
|
CreatedBy |
varchar(255) |
Who created this referral, either a faculty or staff member. |
{{Referrals.CreatedBy}} |
Referrals.CreatedBy
|
NotesInstrData |
text |
Notes entered while the referral is being submitted. |
{{Referrals.NotesInstrData}} |
Referrals.NotesInstrData
|
ReasonsData |
json |
An array of chosen reasons in this referral. |
Reasons* |
Referrals.ReasonsData
|
ReasonsAndLabels |
|
Same as above, but this array will also include the reason labels. |
ReasonsAndLabels* |
|
RecommendData |
json |
An array of chosen recommendations in this referral. |
Recommendations* |
Referrals.RecommendData
|
RecommendationsAndLabels |
|
Same as above, but this array will also include the recommendation labels. |
RecommendationsAndLabels* |
|
AdditionalNotes |
text |
Additional notes entered during referral submission. |
{{Referrals.AdditionalNotes}} |
Referrals.AdditionalNotes
|
FollowUpDate |
date |
The specified follow-up date from the referral. |
{{Referrals.FollowUpDate}} |
Referrals.FollowUpDate
|
FollowUpBy |
varchar(255) |
The name of the user who followed up on this referral. |
{{Referrals.FollowUpBy}} |
Referrals.FollowUpBy
|
FollowedUp |
tinyint |
Whether or not this referral has been followed up on. |
{{Referrals.FollowedUp}} |
Referrals.FollowedUp
|
FollowedUpDT |
datetime |
The date and time this referral was followed up on. |
{{Referrals.FollowedUpDT}} |
Referrals.FollowedUpDT
|
Processed |
tinyint |
Whether or not this referral has been processed (resolved). |
{{Referrals.Processed}} |
Referrals.Processed
|
ProcessedDT |
datetime |
The date and time this referral was processed. |
{{Referrals.ProcessedDT}} |
Referrals.ProcessedDT
|
ProcessedBy |
varchar(255) |
The user who processed this referral. |
{{Referrals.ProcessedBy}} |
Referrals.ProcessedBy
|
ProcessedNotes |
text |
Notes entered while the referral was being processed. |
{{Referrals.ProcessedNotes}} |
Referrals.ProcessedNotes
|
StudentContacted |
date |
The date the student was contacted about this referral. |
{{Referrals.StudentContacted}} |
Referrals.StudentContacted
|
OverrideResend |
tinyint |
Whether or not the 'Override and resend' feature has been used. |
|
Referrals.OverrideResend
|
AssignedConsultant |
varchar(255) |
The name of the consultant or advisor assigned to this referral. |
{{Referrals.AssignedConsultant}} |
Referrals.AssignedConsultant
|
AssignedConsultantID |
varchar(255) |
The sequence number of the assigned consultant, relates to Staff.Sequence. |
{{Referral.CustomData.AssignedConsultantID}} |
|
Trigger |
The trigger for this email, “Created”, “Followed Up”, or “Processed”
|
Email.Subject |
The contents of the email subject line
|
Questions.CODE |
Questions.[Your custom question code], as covered above
|
Answers.CODE |
Answers.[Your custom question code], as covered above
|
{{ setResultActions('AssignConsultant', '123') }} |
If this line is reached within a SAGE email, the assigned staff member will be changed to the specified sequence. The example below shows how you can use this script to link a student's assigned advisor to the referral.
|
|
{% set staffSeq = getRecordFieldData('Staff','Email', Student.CustomData.cf_1,'Sequence') %}
{{ setResultActions('AssignConsultant', staffSeq) }}
|
{{ setResultActions('SetProcessed', '1') }} |
If this line is reached within an email, the referral will be marked as processed/completed.
|
{{ setResultActions('SetProcessedNotes', 'Example notes') }} |
Typically used alongside the tag above. Used to automatically add notes to the processed referral.
|