What API I can use to add milestone markers via Markers Script ?

Modified on Tue, 22 Aug 2023 at 11:30 AM

So you may want to add release / milestone markers to your gantt widgets. To do so, you can use the Widget parameter Advanced > Markers Script  to add the markers.

The Markers Script is in javascript language, and it is executed on the server and so you have access to Polarion API.

  • The goal is to add milestone markers via: markerFactory.addMarker() call.
  • You have the access to: ITrackerService via trackerService variable and so you can access various Polarion data sources (time points, plans, work items, etc...).

Following example demonstrates how to load the markers from the polarion project timepoints:

  • Open you widget configuration, expand the Advanced Parameters, and set following snippet to Markers Script:

var timePoints = trackerService.getTrackerProject("elibrary").getTimePoints().iterator();


    var tp = timePoints.next();

    var marker = markerFactory.addMarker();




    var desc =  tp.description;





The markerFactory has following methods:

  • markerFactory.addMarker(); - create and register new marker object
  • markerFactory.addMarker(String text, String title); - utility method if you do not have a date as java.util.Date but as a string. 
    Example: markerFactory.addMarker("test","2019-01-30")

The marker object has following methods that you should know:

  • void setText(String text) - set the text / name of the marker

  • void setTitle(String tootlip) - set the tooltip of the marker
  • void setDate(java.util.Date date) - set the date of the marker

  • void setDate(String dateStr) - set the date of the marker as String.
    Date format is "2019-01-30"
  • void setColor(String color) - set the color of the marker.
    It must be one of the 16 basic html colors - https://www.w3.org/TR/REC-html40/types.html#h-6.5

NEW! From Polarion 2304 please make sure to change the script format so it corresponds to the latest requirements:

var timePoints = trackerService.getTrackerProject("GANTT").getTimePoints().iterator();
    var tp = timePoints.next();
    var marker = markerFactory.addMarker();
    var desc =  tp.getDescription();


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