Derive schedule of a item on Gantt from assignment of to a Polarion plan

Modified on Thu, 18 Jan 2024 at 04:11 PM

Sometimes you need to derive a schedule of the Work Item not from fields such as gantt-start and gantt-duration, but you may want to load it from an assignment of the work item to the Polarion Plan.


Imagine there is a user story


and you want this schedule of the user story PCP-43 being derived from the assignment to a sprint (AKA Iteration). As this story is assigned to Iteration 34.




You can configure this with the following Widget Property > Advanced > Item Script


var plans = wi.getPlannedIn().iterator();
while(plans.hasNext()){
   var plan = plans.next();
   if(plan.getTemplate().getId()==="Iteration"){
      task.start_date=util.getDate(plan, "startDate");
      task.end_date=util.getDate(plan, "dueDate");
      task.duration=null;
      task.readonly=true;
      task.unplanned=false;
   }
}



In case you have some unplanned Work Items, you can use the utility method below in the Item Script to derive the Work Items Schedule from the Plan:

task.deriveScheduleFromPlans(IWorkItem item, String templateId)


Example:


There is an unplanned Work Package "The Primary Flight Displays":


It is planned in Iteration 39, which ends 10.10.2023:


Now we are going to use the method mentioned above to make it derive its schedule from the Plan. To do so, add the following snippet to the Item Script section:


   if(task.unplanned){
        task.deriveScheduleFromPlans(wi,"iteration");
   }


As a result, the Work Package gets the schedule from the Plan.





In case of any questions please contact support@nextedy.com




Was this article helpful?

That’s Great!

Thank you for your feedback

Sorry! We couldn't be helpful

Thank you for your feedback

Let us know how can we improve this article!

Select atleast one of the reasons

Feedback sent

We appreciate your effort and will try to fix the article