Skip to content
Release: Australia · Updated: 2026-03-12 · Official documentation · View source

AbstractTimelineSchedulePage- Global

The AbstractTimelineSchedulePage script include is 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 ignores the setDoReRenderTimeline property and explicitly shows only the TimelineItems that were added by theadd() 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 auto-includes these parameters inside the Ajax calls and therefore will be accessible inside the AbstractTimelineSchedulePage script include.

Parent Topic:Server API reference

AbstractTimelineSchedulePage - add(Object ObjTimeline)

Adds a TimelineItem object that will be returned to the client and appropriately displayed on the timeline.

NameTypeDescription
ObjTimelineObjectThe TimelineItem object to add to the timeline.
TypeDescription
void 

AbstractTimelineSchedulePage - addSeparator()

Adds a horizontal frame separator into the list of timeline items. All future items added via add() will be added into the subsequent timeline frame.

All future items added using the add() method are added into the subsequent timeline frame.

NameTypeDescription
None  
TypeDescription
void 

The following code example shows how to call this method.

// Inside of a script include that extends AbstractTimelineSchedulePage
      this.addSeparator();

AbstractTimelineSchedulePage - elementMoveX(String spanSysId, String newStartDateTimeMs)

Event handler for when a timeline span moves horizontally.

NameTypeDescription
spanSysIdStringThe sys ID of the current span being adjusted.
newStartDateTimeMsStringThe new start time of the span in milliseconds. Make sure to parse the string using parseInt() before performing any numerical comparisons.
TypeDescription
void 

AbstractTimelineSchedulePage - elementMoveXY(String spanSysId, String itemSysId, String itemSysId, String newItemSysId, String newStartDateTimeMs)

Event handler for when a timeline span moves both horizontally and vertically.

NameTypeDescription
spanSysIdStringThe sys ID of the current span being adjusted.
itemSysIdStringThe sys ID of the timeline item associated with the current span.
newItemSysIdStringThe sys ID of the timeline item (a row) that the current span was dragged into.
newStartDateTimeMsStringThe new start time of the span in milliseconds. Make sure to parse the string using parseInt() before performing any numerical comparisons.
TypeDescription
void 

AbstractTimelineSchedulePage - elementMoveY(String spanSysId, String itemSysId, String newItemSysId)

Event handler for when a timeline span moves vertically.

NameTypeDescription
spanSysIdStringThe sys ID of the current span being adjusted.
itemSysIdStringThe sys ID of the timeline item associated with the current span.
newItemSysIdStringThe sys ID of the timeline item (a row) that the current span was dragged into.
TypeDescription
void 

AbstractTimelineSchedulePage - elementSuccessor(String spanSysId, String newSuccSpanId)

Event handler for when a timeline relationship has been created between two spans.

NameTypeDescription
spanSysIdStringThe sys ID of the current span which will be a predecessor for the newly created relationship.
newSuccSpanIdStringThe sys ID of the successor span from the relationship created.
TypeDescription
voidReturnValue

AbstractTimelineSchedulePage - elementTimeAdjustEnd(String spanSysId, String newEndDateTimeMs)

Event handler for when a timeline span's end date was modified.

NameTypeDescription
spanSysIdStringThe sys ID of the current span that is being adjusted.
newEndDateTimeMsStringThe new end time of the span in milliseconds. Make sure to parse the string using parseInt() prior to performing any numerical comparisons.
TypeDescription
void 

AbstractTimelineSchedulePage - elementTimeAdjustStart(String spanSysId, String newStartDateTimeMs)

Event handler for when a timeline span's start date was modified.

NameTypeDescription
spanSysIdStringThe sys ID of the current span that is being adjusted.
newStartDateTimeMsStringThe new start time of the span in milliseconds. Make sure to parse the string using parseInt() prior to performing any numerical comparisons.
TypeDescription
void 

AbstractTimelineSchedulePage - getItems()

Event handler for returning schedule items to display on the timeline.

NameTypeDescription
none  
TypeDescription
void 

AbstractTimelineSchedulePage - inputBox(String strInputText)

Event handler for when a string was typed into the left pane input box.

NameTypeDescription
strInputTextStringThe text that was entered in the input box in the left pane.
TypeDescription
void 

AbstractTimelineSchedulePage - itemMove(String itemSysId, String newItemSysId)

Event handler for when a timeline row item was moved and dragged into another row item.

NameTypeDescription
itemSysIdStringThe sys ID of the timeline item associated with the current span.
newItemSysIdStringThe sys ID of the timeline item (a row) that the current span was dragged into.
TypeDescription
void 

AbstractTimelineSchedulePage - setDoReRenderTimeline(Boolean b)

Specifies whether or not to re-render all of the timeline items using the getItems() function.

NameTypeDescription
bBooleanIf true, re-render the timeline by making a new event call to the server's getItems() handler.
TypeDescription
void 

AbstractTimelineSchedulePage - setPageTitle(String strTitle)

Specifies the text to display as the title of the timeline.

The page title can be set (and updated) from any interactive event; however, is recommended to be set during thegetItems() event.

NameTypeDescription
strTitleStringThe text to be displayed on the timeline title.
TypeDescription
void 

AbstractTimelineSchedulePage - setStatusError(String strTitle, String strMessage)

Sets the current event request to an error status with a specified title and message to display in phase two of the GlideTimeline event processing.

NameTypeDescription
strTitleStringThe text to be displayed in the dialog box title.
strMessageStringThe text to be displayed within the dialog box. The text can contain HTML formatting.
TypeDescription
void 

AbstractTimelineSchedulePage - setStatusPrompt(String strTitle, String strOkFunction, String strCancelFunction, String strCloseFunction)

Sets the current event request to a prompt error status with a specified title and message to display in a confirmation dialog box during phase two of the GlideTimeline event processing. The confirmation box displays an OK and Cancel button that each generate new events that will call the functions specified the parameter arguments. The custom defined functions for OK, Cancel, and Close receive the same parameter arguments as those for the current event.

The confirmation box displays an OK and Cancel button that each generate new events that will call the functions specified the parameter arguments.

Note: The custom defined functions for OK, Cancel, and Close receive the same parameter arguments as those for the current event.

NameTypeDescription
strTitleStringThe text to display in the dialog box. The text can contain HTML formatting.
strOkFunctionStringThe function to call in the current script include class if the users clicks the OK button.
strCancelFunctionStringThe function to call in the current script include class if the user clicks the Cancel button.
strCloseFunctionStringThe function to call in the current script include class if the user clicks the Close button.
TypeDescription
void 
var MyTimelineScriptIncludeClass = Class.create();
      MyTimelineScriptIncludeClass.prototype = Object.extendsObject(AbstractTimelineSchedulePage, {

      getItems: function() {
      //...
      },

      elementTimeAdjustEnd: function(spanSysId, newEndDateTimeMs) {
      // Display a status prompt dialog box
      this.setStatusPrompt('Confirm Action', 'Are you sure you want to do that?',
      'this._myOkHandlerFunction',  
      'this._myCancelHandlerFunction',
      'this._myCloseHandlerFunction');
      },

      _myOkHandlerFunction: function(spanSysId, newEndDateTimeMs) { // ... },

      _myCancelHandlerFunction: function(spanSysId, newEndDateTimeMs) { // ... },

      _myCloseHandlerFunction: function(spanSysId, newEndDateTimeMs) { // ... }
      };

AbstractTimelineSchedulePage - setStatusSuccess(String strTitle, String strMessage)

Sets the current event request to a success status with a specified title and message to display in phase two of the GlideTimeline event processing.

NameTypeDescription
strTitleStringThe text to be displayed in the dialog box title.
strMessageStringThe text to be displayed within the dialog box. The text can contain HTML formatting.
TypeDescription
void