Skip to main content

What Changed

Since Polarion version 2304, the scripting engine used by the Gantt widget has been updated. Scripts that use direct property access on Polarion objects (such as wi.type.id or wi.status.id) no longer work as expected. You must update these to use getter methods. If your Gantt configuration uses item scripts or configuration scripts, you may encounter errors like:
TypeError: Cannot read property 'id' of undefined

Migration Steps

Step 1: Replace Direct Property Access with Getter Methods

The most common change is replacing direct property access patterns with their getter equivalents.
Old Syntax (Pre-2304)New Syntax (2304+)
wi.type.idwi.getType().getId()
wi.status.idwi.getStatus().getId()
wi.resolution.idwi.getResolution().getId()
wi.priority.idwi.getPriority().getId()

Step 2: Replace Null Checks with typeof Checks

In Polarion 2304+, variables that were previously null when undefined now require typeof checks.
Old Syntax (Pre-2304)New Syntax (2304+)
if (wi != null)if (typeof wi !== 'undefined')
if (plan != null)if (typeof plan !== 'undefined')

Step 3: Update Comparison Operators

Use strict equality operators (===) instead of loose equality (==) for consistent behavior with the updated scripting engine.
// Before (pre-2304)
if (wi.type.id == "task") { ... }

// After (2304+)
if (wi.getType().getId() === "task") { ... }

Step 4: Test Each Script

After updating your scripts, test each one:
  1. Open the Gantt page in edit mode.
  2. Check the browser console for errors (right-click the page, select Inspect, open the Console tab).
  3. Verify that task bars render with the expected colors, markers, and labels.
When upgrading Polarion to 2304 or later, always update your Gantt to the latest version and test all scripts in a staging environment first. Script errors do not crash the Gantt but may cause incorrect rendering or missing visual elements.
Since version 25.4.2, script errors display a warning indicator in the Gantt footer. Click the indicator to see a detailed error message identifying the script and error location.

Common Migration Examples

Color logic script:
// Before
if (wi.type.id == "milestone") {
    task.color = "#ff7043";
}

// After
if (typeof wi !== 'undefined' && wi.getType().getId() === "milestone") {
    task.color = "#ff7043";
}
Progress calculation script:
// Before
if (wi != null && wi.status.id == "done") {
    task.progress = 1;
}

// After
if (typeof wi !== 'undefined' && wi.getStatus().getId() === "done") {
    task.progress = 1;
}

Verification

You should now see your Gantt chart rendering correctly without TypeError messages in the browser console. Task bars should display the expected colors, progress, and markers as defined by your scripts.

See Also

KB ArticlesSupport TicketsSource Code
  • prod-gantt-src/com.nextedy.polarion.gantt/src/com/nextedy/polarion/gantt/model/types/TypesConfig.java