Browse Project Baselines and show Plan Comparison View

Modified on Sun, 2 May, 2021 at 3:04 PM

Goal: We want to be able to show a comparision of current plan to a polarion baseline that user selects.



Gantt Configuration

1) On a Gantt report page (the page where you have your Nextedy GANTT chart), create a page parameter "baselineRevision" of type "string":





2) Put the following script into Gantt Widget properties > Advanced > Item script:

(It loads the baseline data from the historical object, using the UTIL methods getDate and getDuration)


var revision = config.getPageParameters().get("baselineRevision");

if(revision && revision.length>0){
  var origWi = wi.getDataSvc().getVersionedInstance(wi.uri,revision);
  task.planned_start_date=util.getDate(origWi, "start");
  task.planned_duration=util.getDuration(origWi, "initialEstimate")
}


Be careful that the name of fields  (in our case "start" and "initialEstimate") must match your mapping section, in our case we have in mapping section "start" and "initialEstimate", so we use these two fields.



Baseline Portal Page


Now let's create a sample page that shows the project baselines, and let us open a Gantt that shows the difference between current plan and baseline. You can put the same code on any of your project index pages).



Create a new live report page and put the a snippet. Please: adjust the ganttPagePath to your Gantt report page...

#set($projectId = $page.reference.projectId)

### Adjust to your gantt page path
#set($ganttPagePath="/project/$projectId/wiki/Planning/Gantt")

#set($project = $trackerService.getTrackerProject($projectId))

<ul>
#foreach($b in $project.baselinesManager.baselines)
   <li>
   <a target="_blank" href="/polarion/#$ganttPagePath?baselineRevision=$b.getBaseRevision()">
	   	<b>$b.name </b> - $b.getBaseRevision()
   	</a>
   	<br> $b.baseRevisionObject.created <br><br>
   </li>
#end
</ul>
        


You will have something like:



You can now click on the revision on this page and open a current Gantt compared to any historical revision.



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 at least one of the reasons
CAPTCHA verification is required.

Feedback sent

We appreciate your effort and will try to fix the article