Skip to main content

When to Use This Approach

Use plan-derived scheduling when work items do not have their own start/end date fields populated but are assigned to Polarion Plans (iterations, releases) that have defined date ranges. This is common in agile workflows where sprints and iterations define the schedule.

Step 1: Add the Item Script

Navigate to Widget Properties > Advanced > Item Script and add one of the following scripts depending on your scenario.

Option A: Derive Schedule for All Unplanned Items

Use the built-in utility method to automatically assign plan dates to unplanned work items:
if (wi != null) {
  if (task.unplanned) {
    task.deriveScheduleFromPlans(wi, "iteration");
  }
}
Replace "iteration" with the plan template ID that matches your project (e.g., "release", "sprint").

Option B: Derive Schedule for a Specific Plan Type

For more control, iterate through the work item’s plan assignments and match a specific template:
var plans = wi.getPlannedIn().iterator();
while (plans.hasNext()) {
  var plan = plans.next();
  if (plan.getTemplate().getId() === "Iteration") {
    task.setStart_date = util.getDate(plan, "startDate");
    task.setEnd_date = util.getDate(plan, "dueDate");
    task.duration = null;
    task.readonly = true;
    task.unplanned = false;
  }
}
PropertyEffect
task.setStart_dateSets the task start from the plan’s start date
task.setEnd_dateSets the task end from the plan’s due date
task.duration = nullClears duration so it is computed from dates
task.readonly = truePrevents manual editing of derived dates
task.unplanned = falseMarks the item as scheduled on the Gantt chart
Always wrap your Item Script with if (wi != null) to prevent errors when the script processes synthetic or missing work items. Without this check, the script may fail silently.
For Polarion versions before 2304, use task.end_date instead of task.setEnd_date. If you are on Polarion 2304 or newer, use task.setEnd_date. Update your Gantt to version 24.5.3 or later for full compatibility.

Step 2: Configure the Plans Gantt View (Optional)

If you want to display both plans and work items together on a single Gantt chart, use the Plans Gantt widget:
  1. Set Widget Properties > Show Plan Work Item > Enable Show Items to true.
  2. Configure the Load Children depth to control how many levels of sub-plans and work items are displayed.
  3. Set the child link role to load work items under their parent plans.
For portfolio-level visibility, configure the Plans Gantt with Release as the top-level plan template, Iteration as the second level, and work items as the third level. Set Load Children to 3 to display the full hierarchy.

Step 3: Save and Reload

Save the widget properties and reload the page. The Gantt chart recalculates work item positions based on their plan assignments.

Verification

You should now see:
  • Previously unplanned work items now positioned on the Gantt chart at the dates of their assigned plans
  • Derived items marked as read-only (not draggable) if you set task.readonly = true
  • Plan date ranges reflected accurately on the work item task bars

See Also

KB ArticlesSupport TicketsSource Code
  • prod-gantt-src/com.nextedy.polarion.gantt/src/com/nextedy/polarion/gantt/model/Task.java
  • prod-gantt-src/com.nextedy.polarion.gantt/src/com/nextedy/polarion/gantt/projectCalendar/WorkingCalendar.java
  • prod-gantt-src/com.nextedy.polarion.gantt/src/com/nextedy/polarion/gantt/projectCalendar/polarion-config/form layouts/tweak.xml
  • prod-gantt-src/com.nextedy.polarion.gantt/src/com/nextedy/polarion/gantt/model/impl/ExtendedWorkingCalendar.java
  • prod-gantt-src/com.nextedy.polarion.gantt/src/com/nextedy/polarion/gantt/widget/PlansGanttWidget.java