Skip to main content
Configure the Item Script in Widget Parameters > Advanced > Item Script.

Script Variables

The following variables are available in the Item Script scope:
Since Polarion version 2304, the scripting engine requires getter methods instead of direct property access. Use wi.getType().getId() instead of wi.type.id. Use typeof wi !== 'undefined' instead of wi != null for existence checks.

Task Object Properties

The task object represents a Gantt chart task. You can read and modify these properties:

Custom Fields Map

Pass additional data to the client using task.getFields():
Access the value on the client side (e.g., in Gantt Config Script templates):

Color Logic

There are two color properties with different behavior:
Use task.taskColor when you want to keep progress-based color indicators (red for overdue, orange for delayed, gray for resolved). Use task.color only when you want to force a specific color regardless of progress status. To use fully static coloring, also set gantt.config.show_progress_colors=false in the Gantt Config Script.

Color by Assignee Example

Color by Type and Status Example

Progress Calculation

Compute progress from time estimates:

Milestone Configuration

Set a task to render as a milestone diamond:

Schedule Derivation from Plans

Derive a task’s schedule from its Polarion plan assignment:
Manual plan schedule derivation:

Baseline Comparison

Set custom baseline values for schedule comparison:

Passing Data to Right-Side Text

Prepare data in the Item Script, then render it in the Gantt Config Script: Item Script:
Gantt Config Script:

Script Execution Flow

diagram

Error Handling

  • Script errors display as a warning indicator in the Gantt chart toolbar
  • The error message includes the prefix Item Script Error:
  • Add null checks before accessing work item properties: if (wi != null) { ... }
  • On Polarion 2304+, use typeof wi !== 'undefined' for existence checks

Configuration Example

A complete Item Script combining progress calculation, color logic, and right-side text:
Last modified on July 10, 2026