Communication Context Variables
Overview
Communication context variables allow for dynamic content to be presented within a communication. For example, a context variable may be used to insert a <Document Requirement Name> into the body of a 'Missing Information' communication email. This page provides the context variables available for use within a communication template.
Template Content
Template content is comprised of two types of scripting languages:
- HTML/CSS markup - communication structure, graphics, static text
- Velocity Template Language (VTL) scripting which provides for the dynamic content - merging in Student, Document, Award data, etc.
The Velocity Templating Engine Syntax is described here: http://velocity.apache.org/engine/devel/vtl-reference-guide.html
CSS code for layout can be used but it must be placed in the <head> element of the HTML document.
Regent Data Model Access
VTL allows one to reference certain context variables that allow access to the Regent Award data model. The data model entities are .NET objects and should be interfaced with using the proper syntax and interface methods as defined by the .NET framework. Please see msdn.microsoft.com for further information.
Context Load Settings mapping
At the current time, Data Models in the spreadsheet attached below are accessible to the Communications engine.
Communication Context Variables (8/12/2024 6.8.0.0 Release)
VelocityTools
There is a utility context variable surfaced in all communication templates accessed with the $tools reference. The following methods are provided by the VelocityTools utility:
- AbsoluteValue(decimal amount) – returns absolute value of amount
- GetCurrentDateTime() – returns System.DateTime.Now object
- Format(string format, params object[] args) – returns string.Format(format,args)
- The following AntiXSS** methods are also provided:
- HtmlEncode(string value) - returns AntiXSS.HtmlEncode(value)
- HtmlEncode(string value, bool useNamedEntities) - returns AntiXSS.HtmlEncode(value, useNamedEntities)
- HtmlAttributeEncode(string value) - returns AntiXSS.HtmlAttributeEncode(value)
- HtmlFormUrlEncode(string value) - returns AntiXSS.HtmlFormUrlEncode(value)
- HtmlFormUrlEncode(string value, int codePage) - returns AntiXSS.HtmlFormUrlEncode(value, codePage)
- HtmlFormUrlEncode(string value, System.Text.Encoding encoding) - returns AntiXSS.HtmlFormUrlEncode(value, encoding)
- JavascriptEncode(string value) - returns AntiXSS.JavaScriptEncode(value)
- JavascriptEncode(string value, bool emitQuotes) - returns AntiXSS.JavaScriptEncode(value, emitQuotes)
- CssEncode(string value) - returns AntiXSS.CssEncode(value)
- UrlEncode(string value) - returns AntiXSS.UrlEncode(value)
- UrlEncode(string value, int codePage) - returns AntiXSS.UrlEncode(value, codePage)
- UrlEncode(string value, System.Text.Encoding encoding) - returns AntiXSS.UrlEncode(value, encoding)
- XmlEncode(string value) - returns AntiXSS.XmlEncode(value)
- XmlAttributeEncode(string value) - returns AntiXSS.XmlAttributeEncode(value)
- DateTime StringToDateTime(string value) - returns DateTime.Parse(value)
- StringToFloat(string value) - returns float.Parse(value)
**AntiXSS – is of class Microsoft.Security.Application.Encoder – the Microsoft Anti-Cross Site Scripting Library
Previewing Templates
You can perform a 'test run' or 'preview' of a communication template using the Preview With Student feature found at the bottom of the Content Editor Text Box. This feature is only available to use when one is in edit mode. In order to preview the template, enter a Student External ID and select the Preview With Student button.