---
sourceDocument: Referência de API do Xanadu
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/pt-BR/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - pt-BR

ft:publication_title :

    - Referência de API do Xanadu

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# GlideTimelineItem - Global

# GlideTimelineItem - Global {#ariaid-title1}

* Versão de lançamento: Xanadu
* 
* Atualizado 1 de ago. de 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 8 min. de leitura

A API GlideTimelineItem estende a classe ScheduleItem abstrata para definir propriedades adicionais que são específicas para a linha do tempo.

Um item de linha do tempo é essencialmente qualquer item exibido em uma linha única na linha do tempo. Um GlideTimelineItem tem zero ou mais períodos associados (objetos TimelineSpan).

## GlideTimelineItem - GlideTimelineItem(cadeia de caracteres "tableName") {#ariaid-title2}

Crie um objeto GlideTimelineItem "fictício".
Isso é útil para criar linhas que não permitem YMovimento para; no entanto, contêm secundários aninhados (por exemplo, a linha "Usuários" de nível superior na linha do tempo de recursos do grupo). O sys_id precisa ser exclusivo para que as funções de nível de DOM sejam analisadas corretamente. Por padrão, este objeto não será "solto" porque um nome de tabela não foi especificado.
{#r_TLI-TimelineItem_S__table_dpl_1jm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| tableName | Cadeia de caracteres | O nome da tabela associada ao objeto atual. |
[Tabela 1. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| vazio |   |
[Tabela 2. Retorna]

{#r_TLI-TimelineItem_S__table_epl_1jm_zt}

## GlideTimelineItem -- GlideTimelineItem(cadeia de caracteres "tableName", cadeia de caracteres sys_id) {#ariaid-title3}

Construtor que define a tabela necessária e as propriedades sys_id .
O restante das propriedades deste objeto deve ser definido pelo solicitante. Por padrão, esta instância de objeto é "soltável", já que um nome de tabela é especificado.
{#r_TLI-TimelineItem_S_S__table_fpl_1jm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| tableName | Cadeia de caracteres | O nome da tabela associada ao objeto atual. |
| sys_id | Cadeia de caracteres | O SYS ID do objeto. |
[Tabela 3. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| vazio |   |
[Tabela 4. Retorna]

{#r_TLI-TimelineItem_S_S__table_gpl_1jm_zt}

## GlideTimelineItem -- createTimelineSpan(cadeia de caracteres "tableName") {#ariaid-title4}

Cria um novo objeto TimelineSpan associado ao objeto de instância atual.
Se nenhum outro objeto TimelineSpan existir, o objeto recém-criado compartilhará o mesmo sys_id que o objeto de instância atual. Caso contrário, um GUID gerado aleatoriamente será usado.
{#r_TLI-createTimelineSpan_S__table_hpl_1jm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| tableName | Cadeia de caracteres | O nome da tabela associada ao objeto atual. |
[Tabela 5. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| Objeto | A instância de objeto de período recém-criada. |
[Tabela 6. Retorna]

{#r_TLI-createTimelineSpan_S__table_ipl_1jm_zt}

## GlideTimelineItem -- createTimelineSpan(cadeia de caracteres "tableName", cadeia de caracteres sys_id) {#ariaid-title5}

Cria um novo objeto TimelineSpan associado ao objeto de instância atual usando a tabela e o sys_id especificados.
{#r_TLI-createTimelineSpan_S_S__table_jpl_1jm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| tableName | Cadeia de caracteres | Nome da tabela associada ao objeto atual |
| sys_id | Cadeia de caracteres | Sys_id do objeto. |
[Tabela 7. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| Objeto | Instância de objeto de período recém-criada. |
[Tabela 8. Retorna]

{#r_TLI-createTimelineSpan_S_S__table_kpl_1jm_zt}  
O exemplo a seguir mostra como usar createTimelineSpan() para criar um novo objeto 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}

Retorna uma cadeia de caracteres que especifica o nome do arquivo de imagem associado ao GlideTimelineItematual.
{#r_TLI-getImage__table_lpl_1jm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| nenhum |   |   |
[Tabela 9. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| Cadeia de caracteres | O nome do arquivo de imagem associado ao GlideTimelineItem atual. Se nenhuma imagem estiver associada ao item atual, uma cadeia de caracteres vazia ("") será retornada. |
[Tabela 10. Retorna]

{#r_TLI-getImage__table_mpl_1jm_zt}

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

Indica se o objeto de instância atual deve ou não ser permitido como uma "zona de lançamento" ao mover elementos da linha do tempo verticalmente.
{#r_TLI-getIsDroppable__table_npl_1jm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| nenhum |   |   |
[Tabela 11. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| Booliano | Verdadeiro se for descartável; caso contrário, falso. |
[Tabela 12. Retorna]

{#r_TLI-getIsDroppable__table_opl_1jm_zt}

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

Retorna o texto a ser exibido no painel esquerdo (se habilitado).
{#r_TLI-getLeftLabelText__table_fmb_2tm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| nenhum |   |   |
[Tabela 13. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| Cadeia de caracteres | O valor do texto a ser exibido no painel esquerdo. |
[Tabela 14. Retorna]

{#r_TLI-getLeftLabelText__table_gmb_2tm_zt}

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

Retorna o sysId exclusivo do objeto primário do GlideTimelineItematual.
{#r_TLI-getParent__table_hmb_2tm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| nenhum |   |   |
[Tabela 15. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| Cadeia de caracteres | O sysId exclusivo do objeto primário do GlideTimelineItem atual. Se o primário não existir, será retornada uma cadeia de caracteres vazia (""). |
[Tabela 16. Retorna]

{#r_TLI-getParent__table_imb_2tm_zt}

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

Retorna todos os objetos TimelineSpan associados à instância atual em um ArrayList.
{#r_TLI-getTimelineSpans__table_jmb_2tm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| nenhum |   |   |
[Tabela 17. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| Matriz de objetos | A lista de objetos TimelineSpan associados à instância atual. |
[Tabela 18. Retorna]

{#r_TLI-getTimelineSpans__table_kmb_2tm_zt}

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

Indica se o texto do painel esquerdo está definido para ser exibido usando um estilo em negrito.
{#r_TLI-isTextBold__table_lmb_2tm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| Nenhum |   |   |
[Tabela 19. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| Booliano | Sinalizador que indica se o texto deve estar em negrito. Valores possíveis: * verdadeiro: o texto deve estar em negrito. * falso: o texto não deve estar em negrito. {#r_TLI-isTextBold__ul_nrf_mzd_2sb} |
[Tabela 20. Retorna]

{#r_TLI-isTextBold__table_mmb_2tm_zt}  
O exemplo a seguir verifica se o estado de um incidente é "Novo" e define o texto do item como negrito.

    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(String strImageName) {#ariaid-title12}

Define o nome do arquivo de imagem (incluindo seu caminho) a ser usado como o ícone do item no painel esquerdo.
{#r_TLI-setImage_S__table_nmb_2tm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| strImageName | Cadeia de caracteres | Nome da imagem, incluindo o caminho. |
[Tabela 21. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| vazio |   |
[Tabela 22. Retorna]

{#r_TLI-setImage_S__table_omb_2tm_zt}  
O exemplo a seguir mostra como usar setImage() para definir a imagem que deve aparecer para o ícone no painel esquerdo.

    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(Booliano b) {#ariaid-title13}

Define se o objeto de instância atual pode ou não ser clicado e arrastado para outro GlideTimelineItem.
{#r_TLI-setIsDraggable_B__table_pmb_2tm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| b | Booliano | Sinalizador que indica se o item pode ser movido clicando e arrastando. Valores válidos: * verdadeiro: o item pode ser movido clicando e arrastando. * falso: o item não pode ser movido clicando e arrastando. {#r_TLI-setIsDraggable_B__ul_h4z_jt1_fsb} |
[Tabela 23. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| vazio |   |
[Tabela 24. Retorna]

{#r_TLI-setIsDraggable_B__table_qmb_2tm_zt}  
O exemplo a seguir mostra como usar setIsDraggable() para permitir que o objeto atual seja arrastado para outro 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(cadeia de caracteres strText) {#ariaid-title14}

Especifica o texto a ser exibido no painel esquerdo deste item.
{#r_TLI-setLeftLabelText_S__table_ibb_lvm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| strText | Cadeia de caracteres | Texto a ser exibido no painel esquerdo deste item. |
[Tabela 25. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| vazio |   |
[Tabela 26. Retorna]

{#r_TLI-setLeftLabelText_S__table_jbb_lvm_zt}  
O exemplo a seguir mostra como usar setLeftLabelText() para definir o texto no painel esquerdo.

    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(String sysId) {#ariaid-title15}

Define o primário do GlideTimelineItematual.
{#r_TLI-setParent_S__table_kbb_lvm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| sysId | Cadeia de caracteres | O sysID do GlideTimelineItem que deve se tornar o primário do GlideTimelineItem atual. |
[Tabela 27. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| vazio |   |
[Tabela 28. Retorna]

{#r_TLI-setParent_S__table_lbb_lvm_zt}

## GlideTimelineItem -- setTextBold(Booliano b) {#ariaid-title16}

Especifica se o estilo de texto do item no painel esquerdo deve ser colocado em negrito ou não.
{#r_TLI-setTextBold_B__table_obb_lvm_zt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| b | Booliano | Sinalizador que indica se o texto no painel esquerdo deve estar em negrito. Valores válidos: * verdadeiro: o texto deve estar em negrito. * falso: o texto não deve estar em negrito. {#r_TLI-setTextBold_B__ul_kn4_1zz_2sb} |
[Tabela 29. Parâmetros]

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

| Tipo | Descrição |
|-|-|
| vazio |   |
[Tabela 30. Retorna]

{#r_TLI-setTextBold_B__table_pbb_lvm_zt}  
O exemplo a seguir mostra como definir o texto no painel esquerdo como negrito.

    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); 
    }


