Skip to main content

Prerequisites

  • A working Nextedy GANTT widget with Plans configured
  • Work items assigned to Polarion Plans (iterations, releases)
  • Access to Widget Parameters > Advanced > Item Script

Option 1: Derive Schedule from Plans Using Item Script

When you need a work item’s dates to come from its plan assignment rather than from its own date fields, add the following to Widget Parameters > Advanced > Item Script:
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;
   }
}
This script iterates through all plans the work item belongs to, finds the one matching the Iteration template, and copies the plan’s start and due dates onto the task bar.

Option 2: Use the Utility Method for Unplanned Items

For work items that have no dates set, use the built-in deriveScheduleFromPlans utility method in your item script:
if(task.unplanned){
    task.deriveScheduleFromPlans(wi, "iteration");
}
This method automatically sets the task’s start and end dates from the matching plan.
If you encounter errors during script execution, the script may be processing a non-existent work item. Add a null check around your script:
if (wi != null){
    if(task.unplanned){
        task.deriveScheduleFromPlans(wi, "iteration");
    }
}

Option 3: Automatic Sync with syncToPlans

You can configure the Gantt to automatically keep work item plan membership in sync when dates are edited. In Widget Parameters > Work Item Types Configuration, enable Sync to Plans for the relevant work item type. When syncToPlans is enabled, saving a task in the Gantt automatically adds or removes the work item from overlapping Polarion Plans that match the configured plan templates.
ConfigurationLocationEffect
Item Script (derive dates)Widget Parameters > Advanced > Item ScriptCopies plan dates onto work item display
deriveScheduleFromPlans()Item Script utility methodSets dates for unplanned items from matching plan
Sync to PlansWork Item Types ConfigurationAuto-updates plan membership on save
When you have many plans (100+), use a contextField filter to limit which plans are considered for sync. This prevents performance issues and ensures only relevant plans are matched. A bug fix in v25.8.0 ensures the most recent plans are fetched by due date.
The plan sync mechanism fetches up to 100 plans by default. If you have more than 100 plans, newer plans may not appear unless you upgrade to v25.8.0 or later, which fetches plans ordered by due date.

Verify

After configuring one of the above methods, reload the Gantt chart. You should now see work items positioned on the timeline according to their assigned plan dates. Unplanned items should display at their plan’s date range, and items with syncToPlans enabled should automatically update plan membership when you drag and save them.

See also

KB ArticlesSupport TicketsSource Code
  • prod-gantt-src/com.nextedy.polarion.gantt/src/com/nextedy/polarion/gantt/model/impl/AbstractBaseGanttDataService.java
  • prod-gantt-src/com.nextedy.polarion.gantt.client/cypress/e2e/Rewritten Tests/testGanttPlansInInline.cy.ts
  • 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/model/impl/WorkItemsGanttDataService.java
  • prod-gantt-src/com.nextedy.polarion.gantt/src/com/nextedy/polarion/gantt/widget/PlansGanttWidget.java