---
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


---

# SystemDocument - Scoped, Global

# SystemDocument - 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 SystemDocument API provides methods for setting fields of a
record in the Documents \[ds_document\] table.

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).

To create a document, use the [DocumentService API](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

## SystemDocument - SystemDocument(String docName) {#ariaid-title2}

Instantiates a SystemDocument object.
{#SystemDoc-SystemDocument_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| docName | String | Name of the document. |
[Table 1. Parameters]

{#SystemDoc-SystemDocument_S__table_o12_jrk_spb} {#SystemDoc-SystemDocument_S__table_p12_jrk_spb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 2. Returns]

{#SystemDoc-SystemDocument_S__table_p12_jrk_spb}  
The following example shows how to instantiate a SystemDocument object
and set several fields for a document record. See also [DocumentService
API](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

    var d = new sn_doc_services.SystemDocument('My document');

    // Define the document fields
    var reviewers = '62826bf03710200044e0bfc8bcbe5df1,a8f98bb0eb32010045e1a5115206fe3a';
    d.description('description');
    d.classification('restricted');
    d.state('review');
    d.department('93b25282c0a8000b0b55c8ab34e2f1e6');
    d.template(false);
    d.type('policy');
    d.reviewers(reviewers);
    d.audience('external');

    var s = new sn_doc_services.DocumentService();
    gs.info(JSON.stringify(s.createDocument(d), null, 2));

Output:

    {
      "message": "Create document sysId : 1040420224503410f877a6fed1c2b031 is successful.",
      "request_id": "1040420224503410f877a6fed1c2b031",
      "status": "success"
    }

## SystemDocument - audience(String audience) {#ariaid-title3}

Sets the Audience field of a document record to specify external or internal
availability. Represents the Audience field in a Document Management
form.
{#SystemDoc-audience_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| audience | String | String representing the intended audience of the document. Possible values: * external * internal {#SystemDoc-audience_S__ul_occ_ydl_spb}Default: internal |
[Table 3. Parameters]

{#SystemDoc-audience_S__table_o12_jrk_spb} {#SystemDoc-audience_S__table_p12_jrk_spb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 4. Returns]

{#SystemDoc-audience_S__table_p12_jrk_spb}  
The following example shows how to set the Audience field in a new document record. See also
[DocumentService - Scoped, Global](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

    var d = new sn_doc_services.SystemDocument('My document');
    var s = new sn_doc_services.DocumentService();

    d.audience('external');

    gs.info(JSON.stringify(s.createDocument(d), null, 2));

Output:

    {
      "message": "Create document sysId : 1193fd4624103410f877a6fed1c2b016 is successful.",
      "request_id": "1193fd4624103410f877a6fed1c2b016",
      "status": "success"
    }

## SystemDocument - classification(String classification) {#ariaid-title4}

Sets the Classification field of a document record to identify the level of information
sensitivity. Represents the Classification field in a Document Management
form.
{#SystemDoc-classification_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| classification | String | Classification of the document. Possible values: * confidential * public * restricted {#SystemDoc-classification_S__ul_nk4_zfl_spb}Default: public |
[Table 5. Parameters]

{#SystemDoc-classification_S__table_o12_jrk_spb} {#SystemDoc-classification_S__table_p12_jrk_spb__entry__2}

| Type | Description |
|-|-|
| String | The value of the classification property of a SystemDocument object. |
[Table 6. Returns]

{#SystemDoc-classification_S__table_p12_jrk_spb}  
The following example shows how to set the classification field in a new document record.
See also [DocumentService API](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

    var d = new sn_doc_services.SystemDocument('My restricted document');
    var s = new sn_doc_services.DocumentService();

    d.classification('restricted');

    gs.info(JSON.stringify(s.createDocument(d), null, 2));

Output:

    {
      "message": "Create document sysId : d80435c624103410f877a6fed1c2b0d0 is successful.",
      "request_id": "d80435c624103410f877a6fed1c2b0d0",
      "status": "success"
    }

## SystemDocument - createdFromTemplate(String docTemplate) {#ariaid-title5}

Sets the template from which to generate a document. When the document is
generated, the specified template is listed in the Created From Template field in the Documents
\[ds_document_list\] table.
{#SystemDoc-createdFromTemplate_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| docTemplate | String | Sys_id of a document listed in the Documents \[ds_document_list\] table. The document must have the Template checkbox selected (true). See also [DocumentVersionService API](https://servicenow-prod.fluidtopics.net/4rBv_OwF58wU1tUMi3qe3g#DocumentVersionServiceBothAPI "The DocumentVersionService API provides a service for creating and deleting document versions. Each version is an element containing the document content and is provided using a single URL or attachment. An attachment can only be added in the Document Versions [ds_document_version] table UI and not with the API."). |
[Table 7. Parameters]

{#SystemDoc-createdFromTemplate_S__table_o12_jrk_spb} {#SystemDoc-createdFromTemplate_S__table_p12_jrk_spb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 8. Returns]

{#SystemDoc-createdFromTemplate_S__table_p12_jrk_spb}  
The following example shows how to create a new document record from an existing template.
See also [DocumentService API](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

    var d = new sn_doc_services.SystemDocument('New doc from template');
    var s = new sn_doc_services.DocumentService();

    d.createdFromTemplate('<doc_template_sys_id>');

    gs.info(JSON.stringify(s.createDocument(d), null, 2));

Output:

    {
      "message": "Create document sysId : deaef1ce24103410f877a6fed1c2b085 is successful.",
      "request_id": "deaef1ce24103410f877a6fed1c2b085",
      "status": "success"
    }

## SystemDocument - department(String docDept) {#ariaid-title6}

Sets the Department field of a document record.
{#SystemDoc-department_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| docDept | String | Sys_id of a department listed in the Departments \[cmn_department\] table. |
[Table 9. Parameters]

{#SystemDoc-department_S__table_o12_jrk_spb} {#SystemDoc-department_S__table_p12_jrk_spb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 10. Returns]

{#SystemDoc-department_S__table_p12_jrk_spb}  
The following example shows how to set the department field in a new document record. See
also [DocumentService
API](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

    var d = new sn_doc_services.SystemDocument('My document');

    // Assign the doc to the human resources department
    d.department('<dept_sys_id>');

    var s = new sn_doc_services.DocumentService();
    gs.info(JSON.stringify(s.createDocument(d), null, 2));

Output:

    {
      "message": "Create document sysId : 491efbee24187410f877a6fed1c2b0a9 is successful.",
      "request_id": "491efbee24187410f877a6fed1c2b0a9",
      "status": "success"
    }

## SystemDocument - description(String description) {#ariaid-title7}

Sets the Description field of a document record.
{#SystemDoc-description_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| description | String | Description of the document. |
[Table 11. Parameters]

{#SystemDoc-description_S__table_o12_jrk_spb} {#SystemDoc-description_S__table_p12_jrk_spb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 12. Returns]

{#SystemDoc-description_S__table_p12_jrk_spb}  
The following example shows how to set the description field in a document record. See
also: [DocumentService
API](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

    var d = new sn_doc_services.SystemDocument('My document');

    d.description('Information describing the doc.');

    var s = new sn_doc_services.DocumentService();
    gs.info(JSON.stringify(s.createDocument(d), null, 2));

Output:

    {
      "message": "Create document sysId : 9acd7fea24587410f877a6fed1c2b060 is successful.",
      "request_id": "9acd7fea24587410f877a6fed1c2b060",
      "status": "success"
    }

## SystemDocument - name(String docName) {#ariaid-title8}

Sets the Name field of a document record.
Note:  
You can also set the name as a parameter in the SystemDocument() constructor.
{#SystemDoc-name_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| docName | String | Name of the document. |
[Table 13. Parameters]

{#SystemDoc-name_S__table_o12_jrk_spb} {#SystemDoc-name_S__table_p12_jrk_spb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 14. Returns]

{#SystemDoc-name_S__table_p12_jrk_spb}  
The following example shows how to set the Name field in a new document record. See also [DocumentService
API](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

    var d = new sn_doc_services.SystemDocument();

    d.name('Document named using method instead of constructor');

    var s = new sn_doc_services.DocumentService();
    gs.info(JSON.stringify(s.createDocument(d), null, 2));

Output:

    {
      "message": "Create document sysId : c19d7f2624587410f877a6fed1c2b0eb is successful.",
      "request_id": "c19d7f2624587410f877a6fed1c2b0eb",
      "status": "success"
    }

## SystemDocument - owner(String owner) {#ariaid-title9}

Sets the Owner field of a document record.
{#SystemDoc-owner_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| owner | String | Sys_id of a user listed in the Users \[sys_user\] table. Role required: admin Default: Current user |
[Table 15. Parameters]

{#SystemDoc-owner_S__table_o12_jrk_spb} {#SystemDoc-owner_S__table_p12_jrk_spb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 16. Returns]

{#SystemDoc-owner_S__table_p12_jrk_spb}  
The following example shows how to set the owner field in a new document record. See also [DocumentService
API](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

    var d = new sn_doc_services.SystemDocument('My document');
    var s = new sn_doc_services.DocumentService();

    d.owner('aa826bf03710200044e0bfc8bcbe5dd6');

    gs.info(JSON.stringify(s.createDocument(d), null, 2));

Output:

    {
      "message": "Create document sysId : 4235318a24103410f877a6fed1c2b0ff is successful.",
      "request_id": "4235318a24103410f877a6fed1c2b0ff",
      "status": "success"
    }

## SystemDocument - reviewers(String reviewers) {#ariaid-title10}

Sets the Reviewers field of a document record.
{#SystemDoc-reviewers_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| reviewers | String | List of one or more document reviewers by sys_id. The reviewer must be a user listed in the Users \[sys_user\] table. |
[Table 17. Parameters]

{#SystemDoc-reviewers_S__table_o12_jrk_spb} {#SystemDoc-reviewers_S__table_p12_jrk_spb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 18. Returns]

{#SystemDoc-reviewers_S__table_p12_jrk_spb}  
The following example shows how to set the reviewers field in a new document record. See also
[DocumentService
API](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

    var d = new sn_doc_services.SystemDocument('My document');

    var reviewers = '62826bf03710200044e0bfc8bcbe5df1,a8f98bb0eb32010045e1a5115206fe3a';
    d.reviewers(reviewers);

    var s = new sn_doc_services.DocumentService();
    gs.info(JSON.stringify(s.createDocument(d), null, 2));

Output:

    {
      "message": "Create document sysId : 8d19f9ca24103410f877a6fed1c2b0aa is successful.",
      "request_id": "8d19f9ca24103410f877a6fed1c2b0aa",
      "status": "success"
    }

## SystemDocument - state(String state) {#ariaid-title11}

Sets the State field of a document record.
{#SystemDoc-state_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| state | String | State of the document representing where the document is in the workflow. Valid values: * draft * submit * review * complete {#SystemDoc-state_S__ul_o3h_zbm_spb}Default: draft |
[Table 19. Parameters]

{#SystemDoc-state_S__table_o12_jrk_spb} {#SystemDoc-state_S__table_thg_lcm_spb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 20. Returns]

{#SystemDoc-state_S__table_thg_lcm_spb}  
The following example shows how to set the state field in a new document record. See also [DocumentService
API](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

    var d = new sn_doc_services.SystemDocument('My document');
    var s = new sn_doc_services.DocumentService();

    d.state('submit');

    gs.info(JSON.stringify(s.createDocument(d), null, 2));

Output:

    {
      "message": "Create document sysId : 19aab54e24103410f877a6fed1c2b03d is successful.",
      "request_id": "19aab54e24103410f877a6fed1c2b03d",
      "status": "success"
    }

## SystemDocument - template(Boolean template) {#ariaid-title12}

Specifies whether a document record is a template.
{#SystemDoc-template_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| template | Boolean | Flag that specifies whether a document record is a template. Valid values: * true: The default version of this document is a template. * false: This document is not a template. {#SystemDoc-template_S__ul_pyf_cgm_spb} Default: false |
[Table 21. Parameters]

{#SystemDoc-template_S__table_o12_jrk_spb} {#SystemDoc-template_S__table_p12_jrk_spb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 22. Returns]

{#SystemDoc-template_S__table_p12_jrk_spb}  
The following example shows how to indicate that a document record is a template. See also
[DocumentService
API](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

    var d = new sn_doc_services.SystemDocument('My document');

    d.template(true);

    var s = new sn_doc_services.DocumentService();
    gs.info(JSON.stringify(s.createDocument(d), null, 2));

Output:

    {
      "message": "Create document sysId : f7f006ce24103410f877a6fed1c2b053 is successful.",
      "request_id": "f7f006ce24103410f877a6fed1c2b053",
      "status": "success"
    }

## SystemDocument - type(String docType) {#ariaid-title13}

Sets the Type field of a document record.
{#SystemDoc-type_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| docType | String | Type of document. Valid values: * contract * guideline * policy * procedure {#SystemDoc-type_S__ul_xzq_qsl_spb}Default: None |
[Table 23. Parameters]

{#SystemDoc-type_S__table_o12_jrk_spb} {#SystemDoc-type_S__table_p12_jrk_spb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 24. Returns]

{#SystemDoc-type_S__table_p12_jrk_spb}  
The following example shows how to set the type field in a new document record. See also [DocumentService
API](https://servicenow-prod.fluidtopics.net/CHqHZXeSYpjShUPRtBPrNA#DocumentServiceBothAPI "The DocumentService API provides methods for creating, deleting, and updating a document.").

    var d = new sn_doc_services.SystemDocument('How to use the document mgmt API');
    var s = new sn_doc_services.DocumentService();

    d.type('guideline');

    gs.info(JSON.stringify(s.createDocument(d), null, 2));

Output:

    {
      "message": "Create document sysId : 8adfb10224503410f877a6fed1c2b0e4 is successful.",
      "request_id": "8adfb10224503410f877a6fed1c2b0e4",
      "status": "success"
    }


