> ## Documentation Index
> Fetch the complete documentation index at: https://learn.nextedy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Migrate Scripts for Polarion 2304+

> Update your Nextedy GANTT item scripts and configuration scripts to work with the scripting engine changes introduced in Polarion 2304 and later versions.

export const LastReviewed = ({date}) => {
  if (!date) return null;
  const formatted = new Date(`${date}T00:00:00Z`).toLocaleDateString("en-US", {
    year: "numeric",
    month: "long",
    day: "numeric",
    timeZone: "UTC"
  });
  return <p className="mt-10 text-sm text-gray-400 dark:text-zinc-500 not-prose">
      Last reviewed on {formatted}
    </p>;
};

## 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.id`          | `wi.getType().getId()`       |
| `wi.status.id`        | `wi.getStatus().getId()`     |
| `wi.resolution.id`    | `wi.getResolution().getId()` |
| `wi.priority.id`      | `wi.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.

```javascript theme={null}
// 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.

<Warning title="Test before production upgrade">
  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.
</Warning>

<Tip title="Error indicator in the footer">
  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.
</Tip>

## Common Migration Examples

**Color logic script:**

```javascript theme={null}
// Before
if (wi.type.id == "milestone") {
    task.color = "#ff7043";
}

// After
if (typeof wi !== 'undefined' && wi.getType().getId() === "milestone") {
    task.color = "#ff7043";
}
```

**Progress calculation script:**

```javascript theme={null}
// 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

* [Debug Script Errors](/gantt/guides/scripting/debug-scripts)
* [Write Item Scripts](/gantt/guides/scripting/item-script-basics)
* [Write Gantt Config Scripts](/gantt/guides/scripting/gantt-config-script)
* [Troubleshooting Script Errors](/gantt/guides/troubleshooting/script-errors)

<LastReviewed date="2026-07-02" />
