Skip to main content

Dynamic Rendering with Template Variables

Published: Not Available

Last Update: Not Available


Using template variables you can create URLs to integrate with other systems by including information about the user's context.

Template variables are represented by a series of values given the special syntax: @X@object.attribute@X@. These variables are expanded when rendered into their corresponding values. Within the UI, they can be used in portal modules and within the body of content items in courses.

Note that not all of these variables will resolve on all pages. For example, if the page is not inside a course, there will be no course-related variables available.

Using context variables

Context itemContext variableExample output
User external person key@X@user.batch_uid@X@123-45-6789
User username (user id)
User student_id (student id)@X@user.student_id@X@jsmith
User full name@X@user.full_name@X@John Smith
User primary key identifier@X@user.pk_string@X@_521_1
User locale@X@user.locale@X@en_GB
User system role(s)@X@user.role@X@System Roles:
C- Course Administrator
U- Guest
N- None
O- Observer
Y- Community Administrator
R- Support
Z- System Admin
H- System Support
* A- User Administrator
User primary institution role@X@user.institution_role@X@
User secondary institution role(s)@X@user.secondary_institution_role@X@student,faculty
User company (as of 3900.34)
User institution email (as of 3900.34)
User other name (as of 3900.34)
User title (as of 3900.34)
User mobile phone (as of 3900.34)@X@user.mobile_phone@X@0-123-456-7890
User website (as of 3900.34)
Course membership role@X@membership.role@X@Course/Organization Roles:
B- Course Builder/Organization Builder
G- Grader/Grader
U- Guest/Guest
P- Instructor/Leader
S- Student/Participant
T- Teacher's Assistant/Assistant
Course external course key@X@course.batch_uid@X@ABC123ABC
Course course
Course name@X@course.course_name@X@Introduction to Concepts in Biology
Course primary key identifier@X@course.pk_string@X@_12344_1
Course URL@X@course.url@X@/courses/1/BIO101/
Course membership role@X@course.role@X@student
Course locale (As of 3900.32)@X@course.locale@X@en_US
Institution hierarchy nodes (As of 3900.32 use with caution. The output can be a long list that might affect an LTI launch.)@X@course.ih_nodes@X@db75df7b-04e8-4d3c-b7f9-7f1371a3f325,fb11e84b-ff7f-44ab-bf77-89299b053232
Institution primary node (As of 3900.32)@X@course.ih_primary_node@X@fb11e84b-ff7f-44ab-bf77-89299b053232
Is it an Ultra course? (As of 3900.32)@X@course.ultra_status@X@false
Content primary key
Content URL@X@content.url@X@/courses/1/BOB101/content/_221_1
Request locale@X@request.locale@X@
Request return URL@X@request.return@X@
System host name@X@system.site_id@X@
Raw course id@X@course.raw_course_id@X@Returns the course.getCourseId() for the current course ignoring the rule that a student is supposed to see the id of the course they are actually enrolled in. Effectively gives the parent course ID to a student LTI launch from the parent of a cross listed corse, not the child section course ID the are enrolled in.

Contributors on this article:

Background image of the author cardProfile picture of the author

Scott Hurrey

Former Director

Integrations, Developer Relations and Standards