Organization Content

Snippets

Updated 2026/07/21

Snippets are reusable code assets that can be embedded into task interfaces and portal pages to extend their behavior beyond the standard configuration. There are four kinds of snippets, each serving a distinct purpose.

Data Sources

Data sources provide dynamic data that can be referenced inside task interfaces — for example, fetching a list of options to populate a question.

Templates

Templates are reusable HTML/CSS markup blocks that can be injected into task or portal page layouts.

Functions

Functions are reusable JavaScript logic blocks that can be called from within task interfaces to perform calculations or transformations.

Handlers

Handlers are event-driven code blocks that respond to specific events within a task interface, such as a candidate submitting an answer or navigating between questions.

Data sources are reusable snippets that provide dynamic data to task interfaces. Instead of hardcoding data inside a question or task, you define it once as a data source and reference it wherever needed.

Use Cases

  • Populating dropdown or selection options in questions.
  • Providing a shared dataset referenced across multiple questions.
  • Injecting configuration values into a task interface at runtime.

Data sources are managed in Organization → Content → Snippets → Data Sources.

Templates are reusable HTML and CSS markup blocks that can be injected into task interfaces or portal pages. They let you define a consistent visual structure once and reuse it across multiple tasks.

Use Cases

  • Defining a shared layout for a custom task interface.
  • Injecting styled content blocks (headers, instruction panels) into multiple questions.
  • Reusing a branded page section across portal pages.

Templates are managed in Organization → Content → Snippets → Templates.

Functions are reusable JavaScript logic blocks that can be called from within task interfaces. They encapsulate calculations, transformations, or validation logic that you want to share across multiple questions or tasks.

Use Cases

  • Calculating a score or derived value from candidate input.
  • Transforming or formatting data before it is displayed.
  • Validating candidate input against custom rules.

Functions are managed in Organization → Content → Snippets → Functions.

A handler turns a test session's data into output. It combines an optional function (JavaScript that computes values from the session data) with a template (Nunjucks or Mustache that renders those values as HTML or text). Handlers are managed in Organization › Snippets › Handlers.

Use cases

Use CaseWhat the handler producesWhere it is used
Test session report summaryAn HTML reportCustom reports on a test
Notification email subject generatorThe email subject (plain text)A step's admin notification email
Notification email body generatorThe email body (HTML)A step's admin notification email
Notification email attachment generatorAn attachment, for example rendered to PDFA step's admin notification email

Every use case receives the same input — the session's Report Input. For notification emails, the step's notification settings decide whether the benchmark, the test's reporting settings and the questions and answers are added to it.

Building a handler

  • Set the Use Case, and for report handlers the Test ID of the test it belongs to.
  • Save real session data under Sample data to preview the output while you work.
  • Turn on Enable function and Enable template as needed; Output: Data and Output: Report show the result live.

The function and template rules are the same for every use case: see Writing the Function and Writing the Template, or start with Build Your First Custom Report.