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

 Release :

    - brazil

ft:locale :

    - pt-BR

ft:publication_title :

    - Referência de API do Brasil

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# RelatedList - Global

# RelatedList - Global {#ariaid-title1}

Versão de lançamento: Brazil  
Atualizado 10 de set. de 2026  
![](https://www.servicenow.com/docs/portal-asset/ico-clock) 5 min. de leitura  
CIRelatedList script include é uma classe de utilitário que fornece métodos para trabalhar com listas relacionadas ao item de configuração (IC).

Cada instância desta inclusão de script contém os detalhes de uma única lista relacionada a um IC específico. Os detalhes desta lista e o conteúdo da lista estão incluídos.

Use com qualquer script de descoberta do lado do servidor.

## RelatedList - addRec(registro de objeto) {#ariaid-title2}

Adiciona o registro especificado à lista relacionada.
{#r_CIRL-addRec_S__table_bzv_mlh_rt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| registro | Object | Cada membro no objeto é um nome de coluna na tabela associada. Por exemplo, se fizer referência à tabela cmdb_serial_number, este valor pode conter algo semelhante ao seguinte: `Se você tiver um número de série, o número de série será igual ao número de série:, "serial_number_type": "bios", "serial_number":"89246", "valid":"true")` |
[Tabela 1. Parâmetros]

{#r_CIRL-addRec_S__table_bzv_mlh_rt} {#r_CIRL-addRec_S__table_czv_mlh_rt__entry__2}

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

{#r_CIRL-addRec_S__table_czv_mlh_rt}  
Este exemplo mostra como adicionar um registro a uma lista relacionada de ICs.

    var ciDataObj = new CIData(); // Instantiate a new CIData class object

    // sys_id of the CI to which the related list is attached.
    var rl = new CIRelatedList('cmdb_serial_number', 'cmdb_ci','0c43b0f5c6112275019abd2bb3dcd78f','true');

    // Create an object and add the serial numbers
    var sr = {"serial_number_type":"bios","serial_number":"1BC5E4z89246","valid":"true"};
    rl.addRec(sr); // Add the related list. Sets the given records to the related list.
    ciDataObj.addRelatedList(rl); // Adding the related list to the cidata
    gs.info(JSON.stringify(rl, null, 4)); // Display the added related list

Saída:

    {
      "GlideRecordUtil": {},
      "ignoreFields": {
        "sys_created_by": true,
        "sys_updated_by": true,
        "sys_mod_count": true
      },
      "records": [
        {
          "serial_number_type": "bios",
          "serial_number": "1BC5E4z89246",
          "valid": "true"
        }
      ],
      "m2m_records": [],
      "table_name": "cmdb_serial_number",
      "field_name": "cmdb_ci",
      "cmdb_ci": "0c43b0f5c6112275019abd2bb3dcd78f",
      "debug_flag": "true",
      "isM2M": false,
      "target_table_name": null,
      "target_ref_field_name": null
    }

## RelatedList - addRecs (registros de matriz) {#ariaid-title3}

Define os registros fornecidos para a lista relacionada.
{#r_CIRL-addRecs_S__table_itb_wlh_rt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| registros | Matriz de objetos | Cada objeto representa um registro na tabela associada. Cada membro no objeto é um nome de coluna nessa tabela. Por exemplo, se fizer referência à tabela cmdb_serial_number, este valor pode conter algo semelhante ao seguinte: `"Serial_number_type":"bios","serial_number_type":"89246","valid":"serial_number_type":"baseboard","serial_number":"w4z89246","valid":"true"]` |
[Tabela 3. Parâmetros]

{#r_CIRL-addRecs_S__table_itb_wlh_rt} {#r_CIRL-addRecs_S__table_jtb_wlh_rt__entry__2}

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

{#r_CIRL-addRecs_S__table_jtb_wlh_rt}  
Este exemplo mostra como adicionar vários registros a uma lista relacionada de ICs.

    var ciDataObj = new CIData(); // Instantiate a new CIData class object

    // sys_id of the CI to which the related list is attached.
    var rl = new CIRelatedList('cmdb_serial_number', 'cmdb_ci','0c43b0f5c6112275019abd2bb3dcd78f','true');

    // Create an object and add the serial numbers
    var sr = [{"serial_number_type":"bios","serial_number":"1BC5E4z89246","valid":"true"},{"serial_number_type":"baseboard","serial_number":"w4z89246","valid":"true"}];

    rl.addRecs(sr); // Add the related list. Sets the given records to the related list.

    ciDataObj.addRelatedList(rl); // Adding the related list to the cidata
    gs.info(JSON.stringify(rl, null, 4)); // Display the added related list

Saída:

    {
      "GlideRecordUtil": {},
      "ignoreFields": {
        "sys_created_by": true,
        "sys_updated_by": true,
        "sys_mod_count": true
      },
      "records": [
        {
          "serial_number_type": "bios",
          "serial_number": "1BC5E4z89246",
          "valid": "true"
        },
        {
          "serial_number_type": "baseboard",
          "serial_number": "w4z89246",
          "valid": "true"
        }
      ],
      "m2m_records": [],
      "table_name": "cmdb_serial_number",
      "field_name": "cmdb_ci",
      "cmdb_ci": "0c43b0f5c6112275019abd2bb3dcd78f",
      "debug_flag": "true",
      "isM2M": false,
      "target_table_name": null,
      "target_ref_field_name": null
    }

## RelatedList - appendXMLChildFld(cadeia de caracteres primária, nome da cadeia de caracteres, datum da cadeia de caracteres) {#ariaid-title4}

Anexa um XML secundário a um campo.
{#r_CIRL-appendXMLChildFld_S_S_S__table_kvc_qph_rt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| primário | Cadeia de caracteres | O elemento primário |
| nome | Cadeia de caracteres | O nome do elemento |
| referência | Cadeia de caracteres | Os dados a serem anexados |
[Tabela 5. Parâmetros]

{#r_CIRL-appendXMLChildFld_S_S_S__table_kvc_qph_rt} {#r_CIRL-appendXMLChildFld_S_S_S__table_lvc_qph_rt__entry__2}

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

{#r_CIRL-appendXMLChildFld_S_S_S__table_lvc_qph_rt}

## RelatedList - appendXMLChildRecord(cadeia de caracteres primária, nome da cadeia de caracteres, registro da cadeia de caracteres) {#ariaid-title5}

Anexa um XML secundário a um registro.
{#r_CIRL-appendXMLChildRecord_S_S_S__table_v3n_2ph_rt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| primário | Cadeia de caracteres | O elemento primário |
| nome | Cadeia de caracteres | O nome do elemento |
| registro | Cadeia de caracteres | O registro |
[Tabela 7. Parâmetros]

{#r_CIRL-appendXMLChildRecord_S_S_S__table_v3n_2ph_rt} {#r_CIRL-appendXMLChildRecord_S_S_S__table_w3n_2ph_rt__entry__2}

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

{#r_CIRL-appendXMLChildRecord_S_S_S__table_w3n_2ph_rt}

## CIRelatedList - checkSysCollection() {#ariaid-title6}

Verifica se esta é uma tabela SysCollection. Se estiver, define o nome da tabela de destino e o nome do campo de referência.
{#r_CIRL-checkSysCollection__table_dn2_hnh_rt__entry__3}

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

{#r_CIRL-checkSysCollection__table_dn2_hnh_rt} {#r_CIRL-checkSysCollection__table_en2_hnh_rt__entry__2}

| Tipo | Descrição |
|-|-|
| RelatedList | Uma instância de CIRelatedList para a lista especificada. |
[Tabela 10. Retorna]

{#r_CIRL-checkSysCollection__table_en2_hnh_rt}

## RelatedList - checkSysM2M() {#ariaid-title7}

Verifica se esta é uma tabela do sistema muitos para muitos. Se estiver, define o nome da tabela de destino e o nome do campo de referência.
{#r_CIRL-checkSysM2M__table_knj_gmh_rt__entry__3}

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

{#r_CIRL-checkSysM2M__table_knj_gmh_rt} {#r_CIRL-checkSysM2M__table_lnj_gmh_rt__entry__2}

| Tipo | Descrição |
|-|-|
| Booliano | Verdadeiro se for uma tabela sys muitos para muitos; caso contrário, falso. |
[Tabela 12. Retorna]

{#r_CIRL-checkSysM2M__table_lnj_gmh_rt}

## CIRelatedList - CIRelatedList (tabela de cadeia de caracteres, cadeia de caracteres refField, cadeia de caracteres cmdb_ci, cadeia de caracteres debugFlag) {#ariaid-title8}

Cria uma instância da classe CIRelatedList. Sem argumentos, simplesmente constrói uma instância vazia.
{#r_CIRL-CIRelatedList_S_S_S_S__table_mxj_zjh_rt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| tabela | Cadeia de caracteres | A tabela que contém a lista relacionada. Se muitos para muitos, a tabela muitos para muitos. |
| RefField | Cadeia de caracteres | O campo de referência na tabela desta lista relacionada. |
| cmdb_ci | Cadeia de caracteres | O sys_id do IC ao qual esta lista está relacionada. |
| DebugFlag | Cadeia de caracteres | Se verdadeiro, o registro em log de depuração será habilitado. |
[Tabela 13. Parâmetros]

{#r_CIRL-CIRelatedList_S_S_S_S__table_mxj_zjh_rt}

## RelatedList - fromXML(elemento de cadeia de caracteres) {#ariaid-title9}

Inicializa esta instância a partir do elemento XML especificado.
{#r_CIRL-fromXML_S__table_jzb_tnh_rt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| elemento | Cadeia de caracteres | Um elemento XML |
[Tabela 14. Parâmetros]

{#r_CIRL-fromXML_S__table_jzb_tnh_rt} {#r_CIRL-fromXML_S__table_kzb_tnh_rt__entry__2}

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

{#r_CIRL-fromXML_S__table_kzb_tnh_rt}

## CIRelatedList - Preencher() {#ariaid-title10}

Preenche o campo this.records desta instância.
{#r_CIRL-populate__table_vfs_tkh_rt__entry__3}

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

{#r_CIRL-populate__table_vfs_tkh_rt} {#r_CIRL-populate__table_wfs_tkh_rt__entry__2}

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

{#r_CIRL-populate__table_wfs_tkh_rt}

## RelatedList - toString(resultado da matriz) {#ariaid-title11}

Faz uma representação de cadeia de caracteres desta instância, empurrando cada linha para o final da matriz de resultado fornecida.
Este método é chamado de ciData.toString()e assume que as linhas de lista relacionadas devem ser recuadas dois espaços.
{#r_CIRL-toString_A__table_ss1_bqh_rt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| resultado | Matriz | O resultado a ser convertido |
[Tabela 18. Parâmetros]

{#r_CIRL-toString_A__table_ss1_bqh_rt} {#r_CIRL-toString_A__table_ts1_bqh_rt__entry__2}

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

{#r_CIRL-toString_A__table_ts1_bqh_rt}

## RelatedList - toXML(Documento de cadeia de caracteres, elemento de cadeia de caracteres) {#ariaid-title12}

Serializa esta instância para XML no documento fornecido e no elemento \<rl\>.
{#r_CIRL-toXML_S_S__table_edx_s4h_rt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| documento | Cadeia de caracteres | O documento |
| elemento | Cadeia de caracteres | O elemento rl |
[Tabela 20. Parâmetros]

{#r_CIRL-toXML_S_S__table_edx_s4h_rt} {#r_CIRL-toXML_S_S__table_fdx_s4h_rt__entry__2}

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

{#r_CIRL-toXML_S_S__table_fdx_s4h_rt}

## RelatedList - remove() {#ariaid-title13}

Remove todos os itens da lista relacionados.
{#r_CIRL-remove__table_wzm_1lh_rt__entry__3}

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

{#r_CIRL-remove__table_wzm_1lh_rt} {#r_CIRL-remove__table_xzm_1lh_rt__entry__2}

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

{#r_CIRL-remove__table_xzm_1lh_rt}  
Este exemplo de código exclui os registros relacionados mapeados com os itens de IC com o nome \*JEMPLOYEE-IBM. Este exemplo é para uma tabela não M2M.

    //Get a configuration item record which has a related list. Example:  CI items with the name = *JEMPLOYEE-IBM.
    var ciRecord = new GlideRecord("cmdb_ci_computer");
    ciRecord.addQuery("name", "*JEMPLOYEE-IBM");
    ciRecord.query();
    if (ciRecord.next()) {

        var relRecordTable = 'cmdb_ci_network_adapter'; // The table containing the related list (if many-to-many, the many-to-many table)
        var relRecordField = 'cmdb_ci'; // The reference field in the table for this related list
        var cmdb_ciHasRelRecord = ciRecord.sys_id; // The sys_id of the CI this list is related to.
        var debugFlag = 'true'; // True if debug logging is enabled.

        // Get the related record List
        var CIRelatedList = new CIRelatedList(relRecordTable, relRecordField, cmdb_ciHasRelRecord, debugFlag);
        CIRelatedList.remove(); // Delete all related records
    }

## RelatedList - xmlToRecord (Registros de cadeia de caracteres, elemento de cadeia de caracteres) {#ariaid-title14}

Converte uma lista relacionada do XML para o formato de registro.
{#r_CIRL-xmlToRecord_S_S__table_k55_c4h_rt__entry__3}

| Nome | Tipo | Descrição |
|-|-|-|
| registros | Cadeia de caracteres | O registro a ser criado |
| elemento | Cadeia de caracteres | O elemento XML |
[Tabela 24. Parâmetros]

{#r_CIRL-xmlToRecord_S_S__table_k55_c4h_rt} {#r_CIRL-xmlToRecord_S_S__table_l55_c4h_rt__entry__2}

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

{#r_CIRL-xmlToRecord_S_S__table_l55_c4h_rt}

