This page has limited source coverage. Variable availability and behavior should be verified against your Polarion version.
Velocity Pre-processing Flow
$variable syntax. The Velocity engine replaces these with actual values from the Polarion server context before any script logic runs.
Available Context Variables
| Variable | Type | Description |
|---|---|---|
$project | IProject | The current Polarion project context. Access project metadata, configuration, and related objects. |
$user | IUser | The currently authenticated Polarion user. Access user ID, name, roles, and preferences. |
$trackerService | ITrackerService | Polarion tracker service for querying work items, projects, and time points via Lucene queries. |
Additional Velocity context variables may be registered by Polarion extensions. The variables listed above are confirmed from the Gantt extension configuration. Check your Polarion instance for the complete set of available Velocity context objects.
Usage in Item Script
Velocity expressions in the Item Script are resolved on the server before the script executes per work item. Use Velocity to inject server-side data into your script logic:Usage in Gantt Config Script
Velocity expressions in the Gantt Config Script are resolved on the server before the script is sent to the client browser:Usage in Markers Script
Velocity expressions in the Markers Script are resolved before marker creation logic runs:Common Patterns
Dynamic Project ID
Avoid hardcoding project IDs by using Velocity:User-Specific Behavior
Customize Gantt behavior based on the current user:Conditional Script Sections
Use Velocity directives to include or exclude entire script blocks:Escaping
The Velocity-resolved script output is escaped for safe embedding in the page. Backslashes, single quotes, and newlines are automatically handled. You do not need to manually escape these characters in your Velocity expressions.Configuration Example
A complete Item Script combining Velocity context with JavaScript logic:Related Pages
- Item Script API — server-side script where Velocity variables are most commonly used
- Gantt Config Script API — client-side script with Velocity pre-processing
- Marker Factory API — Markers Script with Velocity support
- Page Parameters API — user-input parameters accessible alongside Velocity variables
Sources
Sources
Source Code
prod-gantt-src/com.nextedy.polarion.gantt/src/META-INF/hivemodule.xmlprod-gantt-src/com.nextedy.polarion.gantt/src/com/nextedy/polarion/gantt/model/impl/GanttScriptTransformer.java