---
sourceDocument: Xanadu API Reference
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu API Reference

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# DocumentListService - Scoped, Global

# DocumentListService - Scoped, Global {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 5 minutes to read

The DocumentListService API provides methods for creating, deleting, and updating a document list.

This API requires the Document Management
plugin (com.snc.platform_document_management) and is provided within the
`sn_doc_services` namespace. For information, see [Document Services](https://www.servicenow.com/docs/access?context=document-services-landing-page&version=xanadu&pubname=xanadu-servicenow-platform&ft:locale=en-US).  
The Document Management plugin also supports creating lists of document templates to associate with your document. For example, a job application requiring multiple documents such as a diploma, ID, or passport. After you add your document list, you can add document templates:

* [SystemDocumentListEntry](https://servicenow-prod.fluidtopics.net/dTZ4yFvdYi6QadMYeJbW4g#SystemDocumentListEntryBothAPI "The SystemDocumentListEntry API provides methods for setting the record fields in the Document List Entries [ds_document_list_entry] table.") -- Define a document template list entry.
* [DocumentListEntryService](https://servicenow-prod.fluidtopics.net/O8CQazRfDWbzjMyrnT1K~Q#DocumentListEntryServiceBothAPI "The DocumentListEntryService API provides methods for maintaining document templates in a document list.") -- Add or remove a document template list entry.
{#DocumentListServiceBothAPI__ul_asn_gjg_vpb}  
To define a document as a template:

* Define the document object setting the [SystemDocument --
  template()](https://servicenow-prod.fluidtopics.net/hiu62Cu~o3jKLyJ5uf3yhg#SystemDoc-template_S "Specifies whether a document record is a template.") method to true. Create or update the document record with the methods in the [DocumentService](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.") API.
* Select the Template check box of a document in the Documents \[ds_document\] table.
{#DocumentListServiceBothAPI__ul_b12_5zv_wpb}  
The following APIs enable you to define and manage documents:

* [SystemDocument](https://servicenow-prod.fluidtopics.net/hiu62Cu~o3jKLyJ5uf3yhg#SystemDocumentBothAPI "The SystemDocument API provides methods for setting fields of a record in the Documents [ds_document] table.") -- Define a document object.
* [DocumentService](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.") -- Add, update, or delete a document.
{#DocumentListServiceBothAPI__ul_krc_vmf_vpb}  
To define a document as a template:

* Define the document object setting the [SystemDocument --
  template()](https://servicenow-prod.fluidtopics.net/hiu62Cu~o3jKLyJ5uf3yhg#SystemDoc-template_S "Specifies whether a document record is a template.") method to true. Create or update the document record with the methods in the [DocumentService](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.") API.
* Select the Template check box of a document in the Documents \[ds_document\] table.
{#DocumentListServiceBothAPI__d3642e144}

See also [SystemDocumentList](https://servicenow-prod.fluidtopics.net/rr3G17VMlKG_id40USYdIg#SystemDocumentListBothAPI "The SystemDocumentList API provides methods for setting the record fields in the Document Lists [ds_document_lists] table.").

## DocumentListService - DocumentListService() {#ariaid-title2}

Instantiates a DocumentListService object.
{#DLS-DocumentListService__table_zw5_mcg_tpb__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 1. Parameters]

{#DLS-DocumentListService__table_zw5_mcg_tpb}  
The following example shows how to instantiate a DocumentListService
object. See also [SystemDocumentList](https://servicenow-prod.fluidtopics.net/rr3G17VMlKG_id40USYdIg#SystemDocumentListBothAPI "The SystemDocumentList API provides methods for setting the record fields in the Document Lists [ds_document_lists] table.").

    var s = new sn_doc_services.DocumentListService();

## DocumentListService - createDocumentList(SystemDocumentList doc) {#ariaid-title3}

Creates a document list in the Document Lists \[ds_document_lists\] table.
The Document Management plugin also supports creating lists of document templates to associate with your document. For example, a job application requiring multiple documents such as a diploma, ID, or passport. After you add your document list, you can add document templates:

* [SystemDocumentListEntry](https://servicenow-prod.fluidtopics.net/dTZ4yFvdYi6QadMYeJbW4g#SystemDocumentListEntryBothAPI "The SystemDocumentListEntry API provides methods for setting the record fields in the Document List Entries [ds_document_list_entry] table.") -- Define a document template list entry.
* [DocumentListEntryService](https://servicenow-prod.fluidtopics.net/O8CQazRfDWbzjMyrnT1K~Q#DocumentListEntryServiceBothAPI "The DocumentListEntryService API provides methods for maintaining document templates in a document list.") -- Add or remove a document template list entry.
{#DLS-createDocumentList_O__ul_asn_gjg_vpb}

Use the [createDocumentsFromList()](https://servicenow-prod.fluidtopics.net/0dw9H_Qgi6UOWxUD~Znlew#DLS-createDocumentsFromList_S_S_S "Creates documents from a list of document templates.") method to create documents from the document template
list.
{#DLS-createDocumentList_O__table_w4z_2cg_tpb__entry__3}

| Name | Type | Description |
|-|-|-|
| doc | [SystemDocumentList](https://servicenow-prod.fluidtopics.net/rr3G17VMlKG_id40USYdIg#SystemDocumentListBothAPI "The SystemDocumentList API provides methods for setting the record fields in the Document Lists [ds_document_lists] table.") | One or more properties representing fields of a new record. The name property is required and can be set using the SystemDocumentList constructor or name() method. |
[Table 2. Parameters]

{#DLS-createDocumentList_O__table_w4z_2cg_tpb} {#DLS-createDocumentList_O__table_tj4_p5j_34b__entry__2}

| Type | Description |
|-|-|
| Object | Sys_id of the new record in the Document Lists \[ds_document_lists\] table with a success message. Error message otherwise. { "message": "String", "request_id": "String", "status": "String" } |
| \<Object\>.message | Message confirming success or error. Data type: String |
| \<Object\>.request_id | Sys_id of the record in the Document Lists \[ds_document_lists\] table. Data type: String |
| \<Object\>.status | Status indicating whether the operation is successful. Possible values: * success - The operation was successful. * failure -- The operation was not successful. The message provides details. {#DLS-createDocumentList_O__ul_rlv_5cv_j4b} Data type: String |
[Table 3. Returns]

{#DLS-createDocumentList_O__table_tj4_p5j_34b}  
The following example shows how to create a document list. See also [SystemDocumentList](https://servicenow-prod.fluidtopics.net/rr3G17VMlKG_id40USYdIg#SystemDocumentListBothAPI "The SystemDocumentList API provides methods for setting the record fields in the Document Lists [ds_document_lists] table.").

    var dL = new sn_doc_services.SystemDocumentList('My document list');

    // Define the document list field
    dL.description('description');

    var docList = new sn_doc_services.DocumentListService();
    gs.info(JSON.stringify(docList.createDocumentList(dL), null, 2));

Output:

    {
      "message": "Create List for the given name : My document list, List sysId : b2c021a924683c10f877a6fed1c2b0b1 is successful.",
      "request_id": "b2c021a924683c10f877a6fed1c2b0b1",
      "status": "success"
    }

## DocumentListService - createDocumentsFromList(String listSysId, String tableName, String
tableSysId) {#ariaid-title4}

Creates documents from a list of document templates.
Note:  
Before using this method, create a document template list using the [createDocumentList()](https://servicenow-prod.fluidtopics.net/0dw9H_Qgi6UOWxUD~Znlew#DLS-createDocumentList_O "Creates a document list in the Document Lists [ds_document_lists] table.") method.
{#DLS-createDocumentsFromList_S_S_S__table_w4z_2cg_tpb__entry__3}

| Name | Type | Description |
|-|-|-|
| listSysId | String | Sys_id of a document list record in the Document Lists \[ds_document_lists\] table. |
| tableName | String | Name of the table containing the record on which add a list of document template references. |
| tableSysId | String | Sys_id of the record containing the content from which to add a list of document template references. |
[Table 4. Parameters]

{#DLS-createDocumentsFromList_S_S_S__table_w4z_2cg_tpb} {#DLS-createDocumentsFromList_S_S_S__table_tj4_p5j_34b__entry__2}{#DLS-createDocumentsFromList_S_S_S__ph-docserv-ret-obj-basic}{#DLS-createDocumentsFromList_S_S_S__row_pdfgen_ret_msgCnv}

| Type | Description |
|-|-|
| Object | Success or error message. { "message": "String", "request_id": "String", "status": "String" } {#DLS-createDocumentsFromList_S_S_S__api_docserv_codeblock_dets} |
| \<Object\>.message | Message containing the number of document templates in the document list. Data type: String |
| \<Object\>.request_id | Sys_id of the record in the Document Lists \[ds_document_lists\] table. Data type: String |
| \<Object\>.status | Status indicating whether the operation is successful. Possible values: * success - The operation was successful. * failure -- The operation was not successful. The message provides details. {#DLS-createDocumentsFromList_S_S_S__ul_rlv_5cv_j4b} Data type: String |
[Table 5. Returns]

{#DLS-createDocumentsFromList_S_S_S__table_tj4_p5j_34b}  
The
following example shows how add a list of document template references to a record. The
documentation is added to a record in the Incidents \[incident\] table.

    var result = new sn_doc_services.DocumentListService().createDocumentsFromList('21afddea2460fc10f877a6fed1c2b0dd', 'incident', 'd7158da0c0a8016700eef46c8d1f3661');
    gs.info(JSON.stringify(result, null, 2));

Output:

    {
      "message": "Created 1 document references for the given table name: incident, table sysId : d7158da0c0a8016700eef46c8d1f3661 with list SysId 21afddea2460fc10f877a6fed1c2b0dd",
      "request_id": "21afddea2460fc10f877a6fed1c2b0dd",
      "status": "success"
    }

## DocumentListService - deleteDocumentList(String listSysId) {#ariaid-title5}

Removes a document record from the Document Lists \[ds_document_lists\] table.
{#DLS-deleteDocumentList_S__table_w4z_2cg_tpb__entry__3}

| Name | Type | Description |
|-|-|-|
| listSysId | String | Sys_id of a document list record in the Document Lists \[ds_document_lists\] table. |
[Table 6. Parameters]

{#DLS-deleteDocumentList_S__table_w4z_2cg_tpb} {#DLS-deleteDocumentList_S__table_x4z_2cg_tpb__entry__2}{#DLS-deleteDocumentList_S__ph-docserv-ret-obj-basic}

| Type | Description |
|-|-|
| Object | Success or error message. { "message": "String", "request_id": "String", "status": "String" } {#DLS-deleteDocumentList_S__api_docserv_codeblock_dets} |
| \<Object\>.message | Message confirming success or error. Data type: String |
| \<Object\>.request_id | Sys_id of the record in the Document Lists \[ds_document_lists\] table. Data type: String |
| \<Object\>.status | Status indicating whether the operation is successful. Possible values: * success - The operation was successful. * failure -- The operation was not successful. The message provides details. {#DLS-deleteDocumentList_S__ul_rlv_5cv_j4b} Data type: String |
[Table 7. Returns]

{#DLS-deleteDocumentList_S__table_x4z_2cg_tpb}  
The following example shows how to delete a document list record. See also [SystemDocumentList](https://servicenow-prod.fluidtopics.net/rr3G17VMlKG_id40USYdIg#SystemDocumentListBothAPI "The SystemDocumentList API provides methods for setting the record fields in the Document Lists [ds_document_lists] table.").

    var docListID = 'b2c021a924683c10f877a6fed1c2b0b1';

    var docListSvc = new sn_doc_services.DocumentListService();
    gs.info(JSON.stringify(docListSvc.deleteDocumentList(docListID), null, 2));

Output:

    {
      "message": "Delete List for the given sysId : b2c021a924683c10f877a6fed1c2b0b1 is successful.",
      "request_id": "b2c021a924683c10f877a6fed1c2b0b1",
      "status": "success"
    }

## DocumentListService - updateDocumentList(String docSysId, SystemDocumentList doc) {#ariaid-title6}

Updates the field values of an existing document list.
{#DLS-updateDocumentList_S_O__table_w4z_2cg_tpb__entry__3}

| Name | Type | Description |
|-|-|-|
| listSysId | String | Sys_id of a document list record in the Document Lists \[ds_document_lists\] table. |
| doc | [SystemDocument](https://servicenow-prod.fluidtopics.net/hiu62Cu~o3jKLyJ5uf3yhg#SystemDocumentBothAPI "The SystemDocument API provides methods for setting fields of a record in the Documents [ds_document] table.") | One or more properties representing document list fields to be updated. |
[Table 8. Parameters]

{#DLS-updateDocumentList_S_O__table_w4z_2cg_tpb} {#DLS-updateDocumentList_S_O__table_x4z_2cg_tpb__entry__2}{#DLS-updateDocumentList_S_O__ph-docserv-ret-obj-basic}

| Type | Description |
|-|-|
| Object | Success or error message. { "message": "String", "request_id": "String", "status": "String" } {#DLS-updateDocumentList_S_O__api_docserv_codeblock_dets} |
| \<Object\>.message | Message confirming success or error. Data type: String |
| \<Object\>.request_id | Sys_id of the record in the Document Lists \[ds_document_lists\] table. Data type: String |
| \<Object\>.status | Status indicating whether the operation is successful. Possible values: * success - The operation was successful. * failure -- The operation was not successful. The message provides details. {#DLS-updateDocumentList_S_O__ul_rlv_5cv_j4b} Data type: String |
[Table 9. Returns]

{#DLS-updateDocumentList_S_O__table_x4z_2cg_tpb}  
The following example shows how to update a document list name and description. See also
[SystemDocumentList](https://servicenow-prod.fluidtopics.net/rr3G17VMlKG_id40USYdIg#SystemDocumentListBothAPI "The SystemDocumentList API provides methods for setting the record fields in the Document Lists [ds_document_lists] table.").

    var docListID = 'b2c021a924683c10f877a6fed1c2b0b1';

    var docListUpdate = new sn_doc_services.SystemDocumentList();
    docListUpdate.name('name change');
    docListUpdate.description('description update');

    var docListSvc = new sn_doc_services.DocumentListService();
    gs.info(JSON.stringify(docListSvc.updateDocumentList(docListID , docListUpdate), null, 2));

Output:

    {
      "message": "Update List for the given sysId : b2c021a924683c10f877a6fed1c2b0b1 is successful.",
      "request_id": "b2c021a924683c10f877a6fed1c2b0b1",
      "status": "success"
    }


