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


---

# SystemDocumentVersion - Scoped, Global

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

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

The SystemDocumentVersion API provides methods for setting the values
of a document's source version in the Versions \[ds_document_version\] 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 version, use the [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.").

## SystemDocumentVersion - SystemDocumentVersion(String docSysId) {#ariaid-title2}

Instantiates a SystemDocumentVersion object.
{#SysDocVer-SystemDocumentVersion_S__table_o12_jrk_spb__entry__3}{#SysDocVer-SystemDocumentVersion_S__ph_docserv_parm_docID}

| Name | Type | Description |
|-|-|-|
| docSysId | String | Sys_id of a document record in the Documents \[ds_document\] table. |
[Table 1. Parameters]

{#SysDocVer-SystemDocumentVersion_S__table_o12_jrk_spb} {#SysDocVer-SystemDocumentVersion_S__table_p12_jrk_spb__entry__2}

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

{#SysDocVer-SystemDocumentVersion_S__table_p12_jrk_spb}  
The following example shows how to instantiate a SystemDocumentVersion
object and create a document version. See also [DocumentVersionService](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.").

    var versionDefinition = new sn_doc_services.SystemDocumentVersion('491efbee24187410f877a6fed1c2b0a9');

    versionDefinition.type('url');
    versionDefinition.url('http://one/1.0');

    var versionSvc = new sn_doc_services.DocumentVersionService();
    gs.info(JSON.stringify(versionSvc.createDocumentVersion(versionDefinition), null, 2));

Output:

    {
      "message": "Adding an entry to DocumentVersion for the given docId : 491efbee24187410f877a6fed1c2b0a9, sysId : d5a340d9242cf810f877a6fed1c2b069 is successful.",
      "request_id": "d5a340d9242cf810f877a6fed1c2b069",
      "status": "success"
    }

## SystemDocumentVersion - document(String docSysId) {#ariaid-title3}

Specifies the document record for this version.
Note:  
You can alternatively set the name as a parameter in the SystemDocumentVersion() constructor.
{#SysDocVer-document_S__table_o12_jrk_spb__entry__3}{#SysDocVer-document_S__ph_docserv_parm_docID}

| Name | Type | Description |
|-|-|-|
| docSysId | String | Sys_id of a document record in the Documents \[ds_document\] table. |
[Table 3. Parameters]

{#SysDocVer-document_S__table_o12_jrk_spb} {#SysDocVer-document_S__table_p12_jrk_spb__entry__2}

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

{#SysDocVer-document_S__table_p12_jrk_spb}  
The following example shows how to set the name field of a document version. See also
DocumentVersionService -- [createDocumentVersion()](https://servicenow-prod.fluidtopics.net/4rBv_OwF58wU1tUMi3qe3g#DocVersSvc-createDocumentVersion_O "Creates a document version record in the Versions [ds_document_version] table.").

    var versionDefinition = new sn_doc_services.SystemDocumentVersion();

    versionDefinition.document('491efbee24187410f877a6fed1c2b0a9');

    var versionSvc = new sn_doc_services.DocumentVersionService();
    gs.info(JSON.stringify(versionSvc.createDocumentVersion(versionDefinition), null, 2));

Output:

    {
      "message": "Adding an entry to DocumentVersion for the given docId : 491efbee24187410f877a6fed1c2b0a9, sysId : 1c504c91242cf810f877a6fed1c2b08b is successful.",
      "request_id": "1c504c91242cf810f877a6fed1c2b08b",
      "status": "success"
    }

## SystemDocumentVersion - type(String docType) {#ariaid-title4}

Sets the Type field of a document version.
{#SysDocVer-type_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| docType | String | Document source type. Valid values: * url * attachment {#SysDocVer-type_S__ul_xzq_qsl_spb}Default: attachment Note: An attachment can currently only be added in the Document Versions \[ds_document_version\] table UI and not with the API. |
[Table 5. Parameters]

{#SysDocVer-type_S__table_o12_jrk_spb} {#SysDocVer-type_S__table_p12_jrk_spb__entry__2}

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

{#SysDocVer-type_S__table_p12_jrk_spb}  
The following example shows how to set the type field and create a document version. See
also [DocumentVersionService](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.").

    var versionDefinition = new sn_doc_services.SystemDocumentVersion('491efbee24187410f877a6fed1c2b0a9');

    versionDefinition.type('url');
    versionDefinition.url('http://one/1.0');

    var versionSvc = new sn_doc_services.DocumentVersionService();
    gs.info(JSON.stringify(versionSvc.createDocumentVersion(versionDefinition), null, 2));

    {
      "message": "Adding an entry to DocumentVersion for the given docId : 491efbee24187410f877a6fed1c2b0a9, sysId : d5a340d9242cf810f877a6fed1c2b069 is successful.",
      "request_id": "d5a340d9242cf810f877a6fed1c2b069",
      "status": "success"
    }

## SystemDocumentVersion - url(String url) {#ariaid-title5}

Sets the URL of a document version.
{#SysDocVer-url_S__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| url | String | URL of the source document for this version. |
[Table 7. Parameters]

{#SysDocVer-url_S__table_o12_jrk_spb} {#SysDocVer-url_S__table_p12_jrk_spb__entry__2}

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

{#SysDocVer-url_S__table_p12_jrk_spb}  
The following example shows how to set the URL field as the source of a document version.
See also [DocumentVersionService](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.").

    var versionDefinition = new sn_doc_services.SystemDocumentVersion('491efbee24187410f877a6fed1c2b0a9');

    versionDefinition.type('url');
    versionDefinition.url('http://one/1.0');

    var versionSvc = new sn_doc_services.DocumentVersionService();
    gs.info(JSON.stringify(versionSvc.createDocumentVersion(versionDefinition), null, 2));

    {
      "message": "Adding an entry to DocumentVersion for the given docId : 491efbee24187410f877a6fed1c2b0a9, sysId : d5a340d9242cf810f877a6fed1c2b069 is successful.",
      "request_id": "d5a340d9242cf810f877a6fed1c2b069",
      "status": "success"
    }

## SystemDocumentVersion - versionNumber(Number versionNumber) {#ariaid-title6}

Sets the number of a document version.
{#SysDocVer-versionNumber_N__table_o12_jrk_spb__entry__3}

| Name | Type | Description |
|-|-|-|
| versionNumber | Number | Version number for this document. |
[Table 9. Parameters]

{#SysDocVer-versionNumber_N__table_o12_jrk_spb} {#SysDocVer-versionNumber_N__table_p12_jrk_spb__entry__2}

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

{#SysDocVer-versionNumber_N__table_p12_jrk_spb}  
The following example shows how to set the version number and create a document version.
See also [DocumentVersionService](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.").

    var versionDefinition = new sn_doc_services.SystemDocumentVersion('491efbee24187410f877a6fed1c2b0a9');

    versionDefinition.type('url');
    versionDefinition.url('http://one/1.0');
    versionDefinition.versionNumber(5);

    var versionSvc = new sn_doc_services.DocumentVersionService();
    gs.info(JSON.stringify(versionSvc.createDocumentVersion(versionDefinition), null, 2));

Output:

    {
      "message": "Adding an entry to DocumentVersion for the given docId : 491efbee24187410f877a6fed1c2b0a9, sysId : ff47449d242cf810f877a6fed1c2b06c is successful.",
      "request_id": "ff47449d242cf810f877a6fed1c2b06c",
      "status": "success"
    }


