{"revision":"c10276e953456835cdbb1f3a60d58ae1980be353","document":{"id":1118,"path":"api-reference/server-api-reference/c_TimelineSpan.md","title":"TimelineSpan - Global","bundle":null,"doc_type":null,"release":"australia","body":"\n# TimelineSpan- Global\n\nThe TimelineSpan API provides methods to define a set of properties that describe the characteristics and interactive behavior of an element rendered within a time line item.\n\nSince it is extremely important for all of a time line item's collection of spans to be unique, the creation of a new instance should be performed using the createTimelineItem\\(\\) method of an existing time line Item instance.\n\n**Parent Topic:**[Server API reference](https://raw.githubusercontent.com/ServiceNow/ServiceNowDocs/australia/markdown/australia/api-reference/server-api-reference/api-server.md)\n\n## TimelineSpan - addPredecessor\\(Object Array objArray\\)\n\nAdds multiple relationships between the current instance and other TimelineSpan objects by enumerating through the array of JavaScript objects.\n\nEach object should have an internal property **relationship\\_sys\\_id** and **predecessor\\_sys\\_id** specified.\n\n|Name|Type|Description|\n|----|----|-----------|\n|objArray|Object Array|JavaScript object array that contains two internal properties:**relationship\\_sys\\_id** and **predecessor\\_sys\\_id**.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - addPredecessor\\(String strPredecessorSysId, String strRelationshipSysId, String strTableName\\)\n\nAdds the specified relationship between the current instance and another TimelineSpan and allows the relationship to open a GlideWindow to display information about the relationship.\n\n|Name|Type|Description|\n|----|----|-----------|\n|strPredecessorSysId|String|Sys\\_id of the planned task record that is the predecessor of the relationship.|\n|strRelationshipSysId|String|Sys\\_id of the relationship record of the relationship.|\n|strTableName|String|Name of the table for the relationship.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - addPredecessor\\(String strPredecessorSysId, String strRelationshipSysId\\)\n\nAdds the specified relationship between the current instance and another time line span with sys\\_id **strPredecessorSysId**.\n\nThe drawn line will not have any double click handlers associated with it.\n\n|Name|Type|Description|\n|----|----|-----------|\n|strPredecessorSysId|String|Sys\\_id of the planned task record that is the predecessor of the relationship.|\n|strRelationshipSysId|String|Sys\\_id of the relationship record of the relationship.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - getAllowXDragLeft\\(\\)\n\nReturns the boolean value of the **AllowXDragLeft** property.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_fh2_5bs_zt\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the object's start time can be adjusted.Valid values:\n\n-   true: Object start time can be adjusted.\n-   false: Object start time can't be adjusted.\n\n</td></tr></tbody>\n</table>## TimelineSpan - getAllowXDragRight\\(\\)\n\nReturns the boolean value of the **AllowXDragRight** property.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_hh2_5bs_zt\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the object's end time can be adjusted.Valid values:\n\n-   true: Object end time can be adjusted.\n-   false: Object end time can't be adjusted.\n\n</td></tr></tbody>\n</table>## TimelineSpan - getAllowXMove\\(\\)\n\nReturns the boolean value of the **AllowXMove** property.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_jh2_5bs_zt\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the object can be moved horizontally.Valid values:\n\n-   true: Object can be moved horizontally.\n-   false: Object can't be moved horizontally.\n\n</td></tr></tbody>\n</table>## TimelineSpan - getAllowYMove\\(\\)\n\nReturns the boolean value of the **AllowYMove** property.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_rhw_gds_zt\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the object can be moved vertically.Valid values:\n\n-   true: Object can be moved vertically.\n-   false: Object can't be moved vertically.\n\n</td></tr></tbody>\n</table>## TimelineSpan - getAllowYMovePredecessor\\(\\)\n\nReturns the boolean value of the **AllowYMovePredecessor** property.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_thw_gds_zt\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the a dashed relationship line can be drawn from the current object to a new successor.Valid values:\n\n-   true: Dashed relationship line can be drawn from the current object to a new successor.\n-   false: Dashed relationship line can't be drawn from the current object to a new successor.\n\n</td></tr></tbody>\n</table>## TimelineSpan - getInnerSegmentClass\\(\\)\n\nReturns the name of the current inner segment class for the time line span.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Name of the class for the current inner segment style.|\n\n## TimelineSpan - getInnerSegmentEndTimeMs\\(\\)\n\nReturns the time in milliseconds of the end time of the inner segment portion of the timeline span.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_zhw_gds_zt\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nNumber\n\n</td><td>\n\nEnd time of the timeline span inner segment portion.Unit: Milliseconds\n\n</td></tr></tbody>\n</table>## TimelineSpan - getInnerSegmentStartTimeMs\\(\\)\n\nReturns the time in milliseconds of the start time of the inner segment portion of the timeline span.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_b3w_gds_zt\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nNumber\n\n</td><td>\n\nStart time of the timeline span inner segment portion.Unit: Milliseconds\n\n</td></tr></tbody>\n</table>## TimelineSpan - getIsChanged\\(\\)\n\nReturns a boolean that specifies whether or not the current timeline item has been modified after initialization.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_obm_g2s_zt\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the current span has been marked as changed.Valid values:\n\n-   true: Marked as changed.\n-   false: Not marked as changed.\n\n</td></tr></tbody>\n</table>## TimelineSpan - getPointIconClass\\(\\)\n\nReturns a string that specifies the name of the icon class to use for displaying the element on the timeline if the current instance has zero duration.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Name of the icon class to use for displaying the current timeline span if the duration is zero.|\n\n## TimelineSpan - getPredecessors\\(\\)\n\nReturns an array of all the predecessor objects associated with the current instance. Each array object is a HashMap that contains a `predecessor_sys_id` and `relationship_sys_id` property.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|Object Array|List of HashMaps that contain two internal properties: `predecessor_sys_id` and `relationship_sys_id`.|\n\n## TimelineSpan - getSpanColor\\(\\)\n\nReturns the string name of the background color specified for displaying this span.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|HTML color name to use as the background color for the element.|\n\n## TimelineSpan - getSpanText\\(\\)\n\nReturns the string that specifies the text to display adjacent to the time element.\n\n**Note:** This text only displays if the GlideTimeline object has enabled timeline text defined using the `glideTimeline.showTimelineText(true)` method.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Text displayed adjacent to the element.|\n\n## TimelineSpan - getStartTimeMs\\(\\)\n\nReturns the start time in milliseconds of the current TimelineSpan object.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n<table id=\"table_ybm_g2s_zt\" class=\"returns\"><thead><tr><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nNumber\n\n</td><td>\n\nStart time of the element.Unit: Milliseconds\n\n</td></tr></tbody>\n</table>## TimelineSpan - getSysId\\(\\)\n\nReturns the sys\\_id of the current object.\n\nThis method is useful for returning the sys\\_id when the current object instance was created without a specific sys\\_id to obtain the dynamically generated GUID.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Unique sys\\_id of the current element.|\n\n## TimelineSpan - getTable\\(\\)\n\nReturns the name of the table where the sys\\_id is referenced.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Table name.|\n\n## TimelineSpan - getTooltip\\(\\)\n\nReturns the text/html to display in the tooltip when the TimelineSpan element is being hovered over.\n\n|Name|Type|Description|\n|----|----|-----------|\n|None| | |\n\n|Type|Description|\n|----|-----------|\n|String|Tooltip text.|\n\n## TimelineSpan - setAllowXDragLeft\\(Boolean bFlag\\)\n\nSets a flag that determines whether the element's start date can be dragged left or right therefore adjusting the duration of the task.\n\nThe effect of this behavior is controlled by the script include that handles the appropriate event. The default value for this property is false.\n\n<table id=\"table_hzv_rfs_zt\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nbFlag\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the element's start date can be adjusted.Valid values:\n\n-   true: Start date can be adjusted.\n-   false: Start date can't be adjusted.\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - setAllowXDragRight\\(Boolean bFlag\\)\n\nSets a flag that determines whether the element's end date can be dragged left or right therefore adjusting the duration of the task.\n\nThe effect of this behavior is controlled by the script include that handles the appropriate event. The default value for this property is false.\n\n<table id=\"table_jzv_rfs_zt\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nbFlag\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the element's end date can be adjusted.Valid values:\n\n-   true: End date can be adjusted.\n-   false: End date can't be adjusted.\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - setAllowXMove\\(Boolean bFlag \\)\n\nSets a flag that determines whether the element can be moved to start at a different time.\n\nThe effect of this behavior is controlled by the script include that handles the appropriate event. The default value for this property is false.\n\n<table id=\"table_lzv_rfs_zt\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nbFlag\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the element can be moved horizontally.Valid values:\n\n-   true: Element can be moved horizontally.\n-   false: Element can't be moved horizontally.\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - setAllowYMove\\(Boolean bFlag \\)\n\nSets a flag that determines whether the element can be dragged vertically on the timeline.\n\nThe effect of this behavior is controlled by the script include that handles the appropriate event. The default value for this property is false.\n\n<table id=\"table_hgg_sgs_zt\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nbFlag\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the element can be moved vertically.Valid values:\n\n-   true: Element can be moved vertically.\n-   false: Element can't be moved vertically.\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - setAllowYMovePredecessor\\(Boolean bFlag\\)\n\nSets a flag that determines whether a dashed relationship line can be drawn from this element interactively on the timeline.\n\nThe effect of this behavior is controlled by the script include that handles the appropriate event. The default value for this property is false.\n\n<table id=\"table_jgg_sgs_zt\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nbFlag\n\n</td><td>\n\nBoolean\n\n</td><td>\n\nFlag that indicates whether the a dashed relationship line can be drawn from the current object to a new successor.Valid values:\n\n-   true: Dashed relationship line can be drawn from the current object to a new successor.\n-   false: Dashed relationship line can't be drawn from the current object to a new successor.\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - setInnerSegmentClass\\(String styleClass\\)\n\nSets the name of the class to use for stylizing the inner segment if it exists.\n\n<table id=\"table_lgg_sgs_zt\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nstyleClass\n\n</td><td>\n\nString\n\n</td><td>\n\nName of the color class to use to stylize the inner segment. Valid values:\n\n-   blue\n-   green\n-   silver\n\nDefault: green\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - setInnerSegmentTimeSpan\\(Number startTimeMs, Number endTimeMs\\)\n\nCreates an inner segment to show within the current timespan defined by the specified range.\n\n<table id=\"table_ngg_sgs_zt\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nstartTimeMs\n\n</td><td>\n\nNumber\n\n</td><td>\n\nStart time.Unit: Milliseconds\n\n</td></tr><tr><td>\n\nendTimeMs\n\n</td><td>\n\nNumber\n\n</td><td>\n\nEnd time.Unit: Milliseconds\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - setPointIconClass\\(String iconClassName\\)\n\nSets the icon class to use for displaying the current element on the timeline if the current instance has zero duration.\n\n**Note:** This only affects the current TimelineSpan object and will take precedence over the defaultPointIconClass specified by the GlideTimeline.\n\n<table id=\"table_pgg_sgs_zt\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\niconClassName\n\n</td><td>\n\nString\n\n</td><td>\n\nIcon class to use to display the current element on the timeline if the current instance has zero duration.Valid values:\n\n-   `black_circle`\n-   `black_square`\n-   `blue_circle`\n-   `blue_square`\n-   `green_circle`\n-   `green_square`\n-   `milestone`\n-   `red_circle`\n-   `red_square`\n-   `sepia_circle`\n-   `sepia_square`\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - setSpanColor\\(String strColor\\)\n\nSets the color for displaying this span.\n\n|Name|Type|Description|\n|----|----|-----------|\n|strColor|String|HTML name for the color of this span.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - setSpanText\\(String strSpanText\\)\n\nSets the text to display adjacent to the time element.\n\n**Note:** This text only displays if the GlideTimeline object has enabled timeline text set using the glideTimeline.showTimelineText\\(true\\) method.\n\n|Name|Type|Description|\n|----|----|-----------|\n|strSpanText|String|Text to display next to the time element.|\n\n|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - setTimeSpan\\(Number nStartTime, Number nEndTimeMs\\)\n\nSets the start and end dates for the current span.\n\n<table id=\"table_yqd_l3s_zt\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nnStartTime\n\n</td><td>\n\nNumber\n\n</td><td>\n\nStart time.Unit: Milliseconds\n\n</td></tr><tr><td>\n\nnEndTimeMs\n\n</td><td>\n\nNumber\n\n</td><td>\n\nEnd time.Unit: Milliseconds\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - setTimeSpan\\(String strStartTime, String strEndTimeMs\\)\n\nSets the start and end times for the current span.\n\n<table id=\"table_yqd_l3s_zt\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nstrStartTime\n\n</td><td>\n\nString\n\n</td><td>\n\nStart time.Unit: Milliseconds\n\n</td></tr><tr><td>\n\nstrEndTimeMs\n\n</td><td>\n\nString\n\n</td><td>\n\nEnd time.Unit: Milliseconds\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n## TimelineSpan - setTooltip\\(String strTooltipText\\)\n\nSets the text to display in the tooltip when the TimelineSpan element is being hovered over.\n\n<table id=\"table_ard_l3s_zt\" class=\"parameters\"><thead><tr><th>\n\nName\n\n</th><th>\n\nType\n\n</th><th>\n\nDescription\n\n</th></tr></thead><tbody><tr><td>\n\nstrTooltipText\n\n</td><td>\n\nString\n\n</td><td>\n\nText to display in the tooltip.**Note:** You can specify valid HTML in this string.\n\n</td></tr></tbody>\n</table>|Type|Description|\n|----|-----------|\n|void| |\n\n"}}