Document Context
| Variable | Type | Description |
|---|---|---|
$document | com.nextedy.risksheet.model.Document | The RISKSHEET document object with access to custom fields and metadata |
$!document.customFields | Map<String, Object> | Document’s custom fields from the Polarion LiveDoc. Access via $!document.customFields.fieldName |
$!document.customFields.item | String | Document custom field: item identifier |
$!document.customFields.owner | String | Document custom field: document owner |
$!document.customFields.version | String | Document custom field: document version |
$!document.customFields.model | String | Document custom field: model identifier |
$!document.customFields.team | String | Document custom field: assigned team |
$!document.updated | java.util.Date | Document’s last update timestamp |
$doc | com.nextedy.risksheet.polarion.RisksheetPolarionServiceImpl.wrapDocument() | Wrapped document object providing enhanced Polarion integration |
documentId | String | Document identifier in format spaceId/documentId |
projectId | String | Polarion project identifier |
Transaction and Service Context
| Variable | Type | Description |
|---|---|---|
$tx | com.polarion.alm.shared.api.transaction.ReadOnlyTransaction | Current read-only transaction for accessing Polarion data |
$transaction | com.polarion.alm.shared.api.transaction.ReadOnlyTransaction | Alias for $tx |
$trackerService | ITrackerService | Polarion work item and project management service |
$securityService | ISecurityService | Polarion security and permissions service |
$txService | ITransactionService | Transaction management service |
$repositoryService | IRepositoryService | File repository and document access service |
Utility Objects
| Variable | Type | Description |
|---|---|---|
$gson | com.google.gson.Gson | JSON serialization/deserialization utility |
$objectFactory | ObjectFactory | Factory for creating Polarion domain objects |
$esc | EscapeTool | HTML/XML/JavaScript escaping utility |
$currentDate | java.util.Date | Current system date and time |
$calendar | java.util.Calendar | Calendar instance for date manipulation |
Accessing Document Custom Fields
Working with Polarion Services
Accessing Work Items
Loading External Configuration Files
Parsing XML Configuration
Context Availability by Template Type
| Template | Document | Services | Transaction | Custom Fields |
|---|---|---|---|---|
| Top Panel | ✓ | ✓ | ✓ | ✓ |
| PDF Export | ✓ | ✓ | ✓ | ✓ |
| Custom Renderer | ✓ | ✓ | ✓ | ✓ |
| Configuration | ✓ | ✓ | ✓ | ✓ |
Common Patterns
Conditional Display Based on Document Field
Dynamically Load Risk Matrix
Access Nested Work Item Properties
The velocity context respects Polarion’s security model. Users can only access work items and documents they have permission to view. The transaction is read-only, preventing unintended modifications.
Error Handling
Escaping Output
When rendering user-supplied data or external content, use the escape utility to prevent XSS vulnerabilities:Integration with Multi-Project Setups
For configurations spanning multiple projects, use document custom fields to reference centralized resources:Sources
Sources
KB ArticlesSupport TicketsSource Code
RisksheetViewServlet.javaAppConfig.tsPdfExportConfigurationService.javaAppConfigParser.ts