AbstractTimeLineSchedulePage - Global

A helper class to facilitate working with the data displayed on timelines.

Processing the data displayed within a timeline starts by executing the corresponding function of the specified script include. Like other script includes, the language syntax is JavaScript and follows the default security constraints of this type of resource. However, because the different types of display options are complex, a helper class was created. To display a timeline, extend the AbstractTimelineSchedulePage class and pair it with it's corresponding schedule page. At a minimum, extending classes should override the getItems() method, as this is the primary event handler for returning items to be displayed on the client.

The client processes the data that AbstractTimelineSchedulePage returns in two phases. The first phase makes the actual updates to the timeline. Immediately after (if configured), the second phase displays a success message box, error message box, or dialog message prompt. In phase one, the available options for manipulating data include:

  • Do Not Update Any Items - This is the default behavior. Do not perform any of the remaining steps in phase one.
  • Update With Specific Items - This is done using: add().
  • Render The Timeline Using the getItems() Function - This is done using: setDoReRenderTimeline(true).
Note: If both TimelineItems are returned and setDoReRenderTimeline is set to true, the system will ignore the setDoReRenderTimeline property and explicitly show only the TimelineItems that were added via the add() function.

The available options in phase two include:

  • Do Not Display Any Message Boxes - This is the default behavior.
  • Display a Success Dialog Box - This is done using: setStatusSuccess().
  • Display an Error Dialog Box - This is done using: setStatusError().
  • Display a Dialog Confirm Box - This is done using: setStatusPrompt().
Note: A script include class that extends AbstractTimelineSchedulePage automatically receives all Uri parameters from the original Url whose prefix begins with sysparm_timeline_. To access the values of these, use: this.getParameter("sysparm_timeline_VARIABLE"); inside your extended class.

This is useful if you need to display a schedule page from a dynamic element, such as from a context menu from a list. By passing in dynamic data via the Url the schedule page will auto-include these parameters inside the Ajax calls and therefore will be accessible inside the AbstractTimelineSchedulePage script includes.