---
sourceDocument: Xanadu API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - ja-JP

ft:publication_title :

    - Xanadu API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideTimelineItem - グローバル

# GlideTimelineItem - グローバル {#ariaid-title1}

* リリースバージョン: Xanadu
* 
* 更新日 2024年08月01日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：18分

GlideTimelineItem API は、抽象 ScheduleItem クラスを拡張して、タイムラインに固有の追加のプロパティを定義します。

タイムラインアイテムは、基本的にタイムライン全体で単一の行に表示されるアイテムです。GlideTimelineItem には、0 個以上のスパン (TimelineSpan オブジェクト) が関連付けられています。

## GlideTimelineItem - GlideTimelineItem(文字列 tableName) {#ariaid-title2}

「ダミー」の GlideTimelineItem オブジェクトを作成します。
これは、YMoving を許可しない行を作成する場合に便利ですが、ネストされた子が含まれます (グループリソースタイムラインの最上位の「ユーザー」行など)。sys_id は、DOM レベル関数を正しく解析するために一意である必要があります。デフォルトでは、テーブル名が指定されていないためこのオブジェクトは「ドロップ可能」ではありません。
{#r_TLI-TimelineItem_S__table_dpl_1jm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| tableName | 文字列 | 現在のオブジェクトに関連付けられているテーブルの名前。 |
[表 : 1. パラメーター]

{#r_TLI-TimelineItem_S__table_dpl_1jm_zt} {#r_TLI-TimelineItem_S__table_epl_1jm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 2. 返される内容]

{#r_TLI-TimelineItem_S__table_epl_1jm_zt}

## GlideTimelineItem - GlideTimelineItem(文字列 tableName, 文字列 sys_id) {#ariaid-title3}

必要なテーブルと sys_id プロパティを設定するコンストラクター。
このオブジェクトの残りのプロパティは、問い合わせユーザーが設定する必要があります。デフォルトでは、テーブル名が指定されているためこのオブジェクトインスタンスは「ドロップ可能」です。
{#r_TLI-TimelineItem_S_S__table_fpl_1jm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| tableName | 文字列 | 現在のオブジェクトに関連付けられているテーブルの名前。 |
| sys_id | 文字列 | オブジェクトの sys ID。 |
[表 : 3. パラメーター]

{#r_TLI-TimelineItem_S_S__table_fpl_1jm_zt} {#r_TLI-TimelineItem_S_S__table_gpl_1jm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 4. 返される内容]

{#r_TLI-TimelineItem_S_S__table_gpl_1jm_zt}

## GlideTimelineItem - createTimelineSpan(文字列 tableName) {#ariaid-title4}

現在のインスタンスオブジェクトに関連付けられた新しい TimelineSpan オブジェクトを作成します。
他の TimelineSpan オブジェクトが存在しない場合、新しく作成されたオブジェクトは現在のインスタンスオブジェクトと同じ sys_id を共有します。それ以外の場合は、ランダムに生成された GUID が使用されます。
{#r_TLI-createTimelineSpan_S__table_hpl_1jm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| tableName | 文字列 | 現在のオブジェクトに関連付けられているテーブルの名前。 |
[表 : 5. パラメーター]

{#r_TLI-createTimelineSpan_S__table_hpl_1jm_zt} {#r_TLI-createTimelineSpan_S__table_ipl_1jm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクト | 新しく作成されたスパンオブジェクトインスタンス。 |
[表 : 6. 返される内容]

{#r_TLI-createTimelineSpan_S__table_ipl_1jm_zt}

## GlideTimelineItem - createTimelineSpan(文字列 tableName, 文字列 sys_id) {#ariaid-title5}

指定されたテーブルと sys_id を使用して現在のインスタンスオブジェクトに関連付けられた新しい TimelineSpan オブジェクトを作成します。
{#r_TLI-createTimelineSpan_S_S__table_jpl_1jm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| tableName | 文字列 | 現在のオブジェクトに関連付けられているテーブルの名前。 |
| sys_id | 文字列 | オブジェクトの sys_id。 |
[表 : 7. パラメーター]

{#r_TLI-createTimelineSpan_S_S__table_jpl_1jm_zt} {#r_TLI-createTimelineSpan_S_S__table_kpl_1jm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクト | 新しく作成されたスパンオブジェクトインスタンス。 |
[表 : 8. 返される内容]

{#r_TLI-createTimelineSpan_S_S__table_kpl_1jm_zt}  
次の例は、createTimelineSpan() を使用して新しい TimelineSpan オブジェクトを作成する方法を示しています。

    var project_id="741cc7491b6f1c5043de32231b4bcbc5"; // Project ID 
    var grUser = new GlideRecord('user_resource');
    grUser.addQuery('planned_task', project_id);
    grUser.setQueryReferences(true);
    grUser.orderBy('user.name', 'DESC');
    grUser.query();
    while (grUser.next()) {
      var item = new GlideTimelineItem(grUser.getTableName(), grUser.user);
      /* Specify the text to display in the left pane for this item. */
      item.setLeftLabelText(grUser.user.name); 
      /* Set the name of the image file (including it's path) */
      item.setImage('../images/icons/user.gifx'); 
      /* Specify whether or not to bold the text style of the item in the left pane. */
      item.setTextBold(true); 
      /* Set whether or not the current instance object can be clicked and dragged into another GlideTimelineItem */
      item.setIsDraggable(true);
      /* Create a new TimelineSpan object associated with the current instance object using the specified table and sys_id. */ 
      item.createTimelineSpan(grUser.getTableName(), grUser.getUniqueValue());
    }

## GlideTimelineItem - getImage( ) {#ariaid-title6}

現在の GlideTimelineItem に関連付けられている画像ファイルの名前を指定する文字列を返します。
{#r_TLI-getImage__table_lpl_1jm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| none |   |   |
[表 : 9. パラメーター]

{#r_TLI-getImage__table_lpl_1jm_zt} {#r_TLI-getImage__table_mpl_1jm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | 現在の GlideTimelineItem に関連付けられている画像ファイルの名前。現在のアイテムに画像が関連付けられていない場合は、空の文字列 ("") が返されます。 |
[表 : 10. 返される内容]

{#r_TLI-getImage__table_mpl_1jm_zt}

## GlideTimelineItem - getIsDroppable( ) {#ariaid-title7}

タイムライン要素を垂直に移動するときに、現在のインスタンスオブジェクトを「ドロップゾーン」として許可するかどうかを示します。
{#r_TLI-getIsDroppable__table_npl_1jm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| none |   |   |
[表 : 11. パラメーター]

{#r_TLI-getIsDroppable__table_npl_1jm_zt} {#r_TLI-getIsDroppable__table_opl_1jm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| ブーリアン | ドロップ可能な場合は true。可能でない場合は false。 |
[表 : 12. 返される内容]

{#r_TLI-getIsDroppable__table_opl_1jm_zt}

## GlideTimelineItem - getLeftLabelText( ) {#ariaid-title8}

左ペインに表示されるテキストを返します (有効な場合)。
{#r_TLI-getLeftLabelText__table_fmb_2tm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| none |   |   |
[表 : 13. パラメーター]

{#r_TLI-getLeftLabelText__table_fmb_2tm_zt} {#r_TLI-getLeftLabelText__table_gmb_2tm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | 左ペインに表示されるテキストの値。 |
[表 : 14. 返される内容]

{#r_TLI-getLeftLabelText__table_gmb_2tm_zt}

## GlideTimelineItem - getParent( ) {#ariaid-title9}

現在の GlideTimelineItem の親オブジェクトの一意の sysId を返します。
{#r_TLI-getParent__table_hmb_2tm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| none |   |   |
[表 : 15. パラメーター]

{#r_TLI-getParent__table_hmb_2tm_zt} {#r_TLI-getParent__table_imb_2tm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| 文字列 | 現在の GlideTimelineItem の親オブジェクトの一意の sysId。親が存在しない場合は、空の文字列 ("") が返されます。 |
[表 : 16. 返される内容]

{#r_TLI-getParent__table_imb_2tm_zt}

## GlideTimelineItem - getTimelineSpans( ) {#ariaid-title10}

ArrayList の現在のインスタンスに関連付けられているすべての TimelineSpan オブジェクトを返します。
{#r_TLI-getTimelineSpans__table_jmb_2tm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| none |   |   |
[表 : 17. パラメーター]

{#r_TLI-getTimelineSpans__table_jmb_2tm_zt} {#r_TLI-getTimelineSpans__table_kmb_2tm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクトアレイ | 現在のインスタンスに関連付けられている TimelineSpan オブジェクトのリスト。 |
[表 : 18. 返される内容]

{#r_TLI-getTimelineSpans__table_kmb_2tm_zt}

## GlideTimelineItem - isTextBold( ) {#ariaid-title11}

左ペインのテキストが太字で表示されるように設定されているかどうかを示します。
{#r_TLI-isTextBold__table_lmb_2tm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 19. パラメーター]

{#r_TLI-isTextBold__table_lmb_2tm_zt} {#r_TLI-isTextBold__table_mmb_2tm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| ブーリアン | テキストを太字にするかどうかを示すフラグ。 可能な値： * true：テキストを太字にする必要があります。 * false：テキストを太字以外にする必要があります。 {#r_TLI-isTextBold__ul_nrf_mzd_2sb} |
[表 : 20. 返される内容]

{#r_TLI-isTextBold__table_mmb_2tm_zt}  
次の例では、インシデントのステータスが「新規」かどうかを確認し、アイテムのテキストを太字に設定します。

    var NewIncidentTimelineScriptInclude = Class.create();
    NewIncidentTimelineScriptInclude.prototype = Object.extendsObject(AbstractTimelineSchedulePage, {

      getItems: function() {
        // Specify the page title 
        this.setPageTitle('New Incident Timeline');

        var groupNew = new GlideTimelineItem('new');
        groupNew.setLeftLabelText('New Incidents');

        groupNew.setImage('../images/icons/all.gifx');
        this.add(groupNew);

        // Get all the new incidents and add them to a new label 
        var grIncident = new GlideRecord('incident');
        grIncident.query();
        while (grIncident.next()) {
          // Loop through all and capture new incidents 
          if (grIncident.incident_state != '1') continue;

          // Create the item and the span item. 
          var item = new GlideTimelineItem(grIncident.getTableName(), grIncident.sys_id);
          var span = item.createTimelineSpan(grIncident.getTableName(), grIncident.sys_id);

          if (grIncident.incident_state == '1') { // New
            item.setParent(groupNew.getSysId());
            // Check and set bold text
              item.setTextBold(item.isTextBold() ? false : true);
            } 
          item.setImage('../images/icons/open.gifx');
          span.setTimeSpan(grIncident.getElement('opened_at').getGlideObject().getNumericValue(),
          grIncident.getElement('opened_at').getGlideObject().getNumericValue());

          // Show different colors based upon the priorities only for new incidents 
          switch (grIncident.getElement('priority').toString()) {
            case '1':
              span.setPointIconClass('red_circle');
              break;
            case '2':
              span.setPointIconClass('red_square');
              break;
            case '3':
              span.setPointIconClass('blue_circle');
              break;
            case '4':
              span.setPointIconClass('blue_square');
              break;
            case '5':
              span.setPointIconClass('sepia_circle');
              break;

              default: // Otherwise, the default point icon class will be used (Milestone)
          }

          // Common item properties 
          item.setLeftLabelText(grIncident.short_description);

          // Common span properties
          span.setSpanText(grIncident.short_description);
          span.setSpanColor('blue');
          span.setTooltip('<strong>' + GlideStringUtil.escapeHTML(grIncident.short_description) +
            '</strong><br>' + grIncident.number);
          this.add(item);
        }
      }

    });

## GlideTimelineItem - setImage(文字列 strImageName) {#ariaid-title12}

左ペインのアイテムのアイコンとして使用する画像ファイルの名前 (パスを含む) を設定します。
{#r_TLI-setImage_S__table_nmb_2tm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| strImageName | 文字列 | パスを含む画像の名前。 |
[表 : 21. パラメーター]

{#r_TLI-setImage_S__table_nmb_2tm_zt} {#r_TLI-setImage_S__table_omb_2tm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 22. 返される内容]

{#r_TLI-setImage_S__table_omb_2tm_zt}  
次の例は、setImage() を使用して左ペインのアイコンに表示される画像を定義する方法を示しています。

    var project_id="741cc7491b6f1c5043de32231b4bcbc5"; // Project ID 
    var grUser = new GlideRecord('user_resource');
    grUser.addQuery('planned_task', project_id);
    grUser.setQueryReferences(true);
    grUser.orderBy('user.name', 'DESC');
    grUser.query();
    while (grUser.next()) {
      var item = new GlideTimelineItem(grUser.getTableName(), grUser.user);
      /* Specify the text to display in the left pane for this item. */
      item.setLeftLabelText(grUser.user.name); 
      /* Set the name of the image file (including it's path) */
      item.setImage('../images/icons/user.gifx'); 
      /* Specify whether or not to bold the text style of the item in the left pane. */
      item.setTextBold(true); 
      /* Set whether or not the current instance object can be clicked and dragged into another GlideTimelineItem */
      item.setIsDraggable(true); 
    }

## GlideTimelineItem - setIsDraggable(ブーリアン b) {#ariaid-title13}

現在のインスタンスオブジェクトをクリックして別の GlideTimelineItem にドラッグできるかどうかを設定します。
{#r_TLI-setIsDraggable_B__table_pmb_2tm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| b | ブーリアン | クリックアンドドラッグでアイテムを移動できるかどうかを示すフラグ。 有効な値： * true：アイテムはクリックアンドドラッグで移動できます。 * false：アイテムはクリックアンドドラッグで移動できません。 {#r_TLI-setIsDraggable_B__ul_h4z_jt1_fsb} |
[表 : 23. パラメーター]

{#r_TLI-setIsDraggable_B__table_pmb_2tm_zt} {#r_TLI-setIsDraggable_B__table_qmb_2tm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 24. 返される内容]

{#r_TLI-setIsDraggable_B__table_qmb_2tm_zt}  
次の例は、setIsDraggable() を使用して、現在のオブジェクトを別の GlideTimelineItem にドラッグできるようにする方法を示しています。

    var project_id="741cc7491b6f1c5043de32231b4bcbc5"; // Project ID 
    var grUser = new GlideRecord('user_resource');
    grUser.addQuery('planned_task', project_id);
    grUser.setQueryReferences(true);
    grUser.orderBy('user.name', 'DESC');
    grUser.query();
    while (grUser.next()) {
      var item = new GlideTimelineItem(grUser.getTableName(), grUser.user);
      /* Specify the text to display in the left pane for this item. */
      item.setLeftLabelText(grUser.user.name); 
      /* Set the name of the image file (including it's path) */
      item.setImage('../images/icons/user.gifx'); 
      /* Specify whether or not to bold the text style of the item in the left pane. */
      item.setTextBold(true); 
      /* Set whether or not the current instance object can be clicked and dragged into another GlideTimelineItem */
      item.setIsDraggable(true); 
    }

## GlideTimelineItem - setLeftLabelText(文字列 strText) {#ariaid-title14}

このアイテムの左ペインに表示するテキストを指定します。
{#r_TLI-setLeftLabelText_S__table_ibb_lvm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| strText | 文字列 | このアイテムの左ペインに表示するテキスト。 |
[表 : 25. パラメーター]

{#r_TLI-setLeftLabelText_S__table_ibb_lvm_zt} {#r_TLI-setLeftLabelText_S__table_jbb_lvm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 26. 返される内容]

{#r_TLI-setLeftLabelText_S__table_jbb_lvm_zt}  
次の例は、setLeftLabelText() を使用して左ペインのテキストを設定する方法を示しています。

    var project_id="741cc7491b6f1c5043de32231b4bcbc5"; // Project ID 
    var grUser = new GlideRecord('user_resource');
    grUser.addQuery('planned_task', project_id);
    grUser.setQueryReferences(true);
    grUser.orderBy('user.name', 'DESC');
    grUser.query();
    while (grUser.next()) {
      var item = new GlideTimelineItem(grUser.getTableName(), grUser.user);
      /* Specify the text to display in the left pane for this item. */
      item.setLeftLabelText(grUser.user.name); 
      /* Set the name of the image file (including it's path) */
      item.setImage('../images/icons/user.gifx'); 
      /* Specify whether or not to bold the text style of the item in the left pane. */
      item.setTextBold(true); 
      /* Set whether or not the current instance object can be clicked and dragged into another GlideTimelineItem */
      item.setIsDraggable(true); 
    }

## GlideTimelineItem - setParent(文字列 sysId) {#ariaid-title15}

現在の GlideTimelineItem の親を設定します。
{#r_TLI-setParent_S__table_kbb_lvm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| sysId | 文字列 | 現在の GlideTimelineItem の親になる必要がある GlideTimelineItem の sysID。 |
[表 : 27. パラメーター]

{#r_TLI-setParent_S__table_kbb_lvm_zt} {#r_TLI-setParent_S__table_lbb_lvm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 28. 返される内容]

{#r_TLI-setParent_S__table_lbb_lvm_zt}

## GlideTimelineItem - setTextBold(ブーリアン b) {#ariaid-title16}

左ペインのアイテムのテキストスタイルを太字にするかどうかを指定します。
{#r_TLI-setTextBold_B__table_obb_lvm_zt__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| b | ブーリアン | 左ペインのテキストを太字にするかどうかを示すフラグ。 有効な値： * true：テキストを太字にする必要があります。 * false：テキストを太字以外にする必要があります。 {#r_TLI-setTextBold_B__ul_kn4_1zz_2sb} |
[表 : 29. パラメーター]

{#r_TLI-setTextBold_B__table_obb_lvm_zt} {#r_TLI-setTextBold_B__table_pbb_lvm_zt__entry__2}

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 30. 返される内容]

{#r_TLI-setTextBold_B__table_pbb_lvm_zt}  
次の例は、左ペインのテキストを太字に設定する方法を示しています。

    var project_id="741cc7491b6f1c5043de32231b4bcbc5"; // Project ID 
    var grUser = new GlideRecord('user_resource');
    grUser.addQuery('planned_task', project_id);
    grUser.setQueryReferences(true);
    grUser.orderBy('user.name', 'DESC');
    grUser.query();
    while (grUser.next()) {
      var item = new GlideTimelineItem(grUser.getTableName(), grUser.user);
      /* Specify the text to display in the left pane for this item. */
      item.setLeftLabelText(grUser.user.name); 
      /* Set the name of the image file (including it's path) */
      item.setImage('../images/icons/user.gifx'); 
      /* Specify whether or not to bold the text style of the item in the left pane. */
      item.setTextBold(true); 
      /* Set whether or not the current instance object can be clicked and dragged into another GlideTimelineItem */
      item.setIsDraggable(true); 
    }


