Velocity Templates
Core Velocity template syntax, available context variables, macro definitions, and best practices for all Risksheet template types.
Top Panel Template
Customize the panel above the Risksheet grid with buttons, filters, summary statistics, risk profile displays, and interactive controls using Velocity and HTML.
PDF Export Template
Configure PDF export layout, page structure, table formatting, and content rendering using the
risksheetPdfExport.vm Velocity template and export helper macros.Custom Renderer Templates
Build custom cell renderers and row header renderers using server-side Velocity templates for specialized data display and conditional visual formatting.
Template Resolution Flow
Templates follow the same inheritance chain as therisksheet.json configuration file. When Risksheet loads a template (such as risksheetPdfExport.vm for PDF export), it searches for the file in this order:
Template Types Summary
| Template File | Purpose | Server Endpoint | Rendering Engine |
|---|---|---|---|
risksheetPdfExport.vm | PDF export script generation | /api/pdfscript | Velocity + JavaScript |
| Top panel Velocity template | Custom UI panel above the grid | /api/panel | Velocity + HTML |
pdfExportMacros.vm | Shared helper macros for PDF export | Included by PDF template | Velocity |
serverRender column scripts | Per-column custom cell rendering | Per-column configuration | Velocity |
| Row header renderer | Custom row header display | headers.rowHeader.renderer | JavaScript function |
Template Context Access
All Velocity templates have access to a rich context that includes:| Context Variable | Description |
|---|---|
| Document object | Current Polarion LiveDoc document with metadata |
| Transaction | Active Polarion transaction for data operations |
| Polarion services | Server-side API for querying work items and project data |
| Velocity tools | Standard Velocity utility classes for formatting and logic |
| Risksheet configuration | Current risksheet.json settings including columns, enums, and ratings |
| Revision parameter | Document revision for historical views (PDF export) |
If a Velocity template contains syntax errors or references unavailable context variables, Risksheet renders the error as a red message box in place of the expected output. Check the Polarion server logs for detailed template rendering errors.
Related Reference
- Risksheet.json Format for the main configuration file structure that templates extend
- Template Path Configuration for configuring document creation paths and template folder settings
- Document Configuration Override for the override workflow that creates document-specific templates
- Velocity Template Context for the full list of available context variables in Velocity templates
- PDF Export API for the programmatic PDF export interface and export functions available to templates
Sources
Sources
KB ArticlesSupport TicketsSource Code
DocumentConfigProvider.javaRisksheetSetupService.javaAppConfig.tsAppConfigParser.tsRisksheetProduct.java