DocumentReferenceService - Scoped, Global
The DocumentReferenceService API provides methods for managing document references within a target table, such as the Incidents [incident] or Knowledge [kb_knowledge] table. You can use document references to associate information with a record.
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.
- SystemDocument – Define a document object.
- DocumentService – Add, update, or delete a document.
DocumentReferenceService - DocumentReferenceService()
Instantiates a DocumentReferenceService object.
| Name | Type | Description |
|---|---|---|
| None |
The following example shows how to instantiate a DocumentReferenceService object.
var result = new sn_doc_services.DocumentReferenceService();
DocumentReferenceService - addDocumentReference(String docSysId, String targetTable, String tableSysId)
Adds a document reference to a target table record.
| Name | Type | Description |
|---|---|---|
| docSysId | String | Sys_id of a document record in the Documents [ds_document] table. |
| targetTable | String | Name of the target table on which to provide a document reference. |
| tableSysId | String | Sys_id of the target table record to which the document reference is to be added. |
| Type | Description |
|---|---|
| Object | Sys_id of the new record in the Document References [ds_document_reference]
table with a success message. Error message
otherwise. |
| <Object>.message | Message confirming success or error. If successful, includes the sys_id of the record the document reference was added
to. Data type: String |
| <Object>.status | Status indicating whether the operation is successful. Possible values:
Data type: String |
The following example shows how to add a document reference to a record in the Incidents [incident] table.
var docReference = new sn_doc_services.DocumentReferenceService();
var result = docReference.addDocumentReference("<docSysId>", "incident", "<tableSysId>");
gs.info(JSON.stringify(result, null, 2));
{
"message": "Adding an entry to DocumentReference for the given docId to target table : incident, sysId : <tableSysId> is successful.",
"status": "success"
}DocumentReferenceService - removeDocumentReference(String docSysId, String targetTable, String tableSysId)
Removes a document reference from the Document References [ds_document_reference] table.
| Name | Type | Description |
|---|---|---|
| docSysId | String | Sys_id of a document record in the Documents [ds_document] table. |
| targetTable | String | Name of the table containing the document reference. This information is listed with the document in the Document References [ds_document_reference] table. |
| tableSysId | String | Sys_id of the record from which the document is referenced. You can find related information listed with the document in the Document References [ds_document_reference] table. |
| Type | Description |
|---|---|
| Object | Success message. Error message
otherwise. |
| <Object>.message | Message confirming success or error. If successful, includes the sys_id of the record the document reference was
removed from. Data type: String |
| <Object>.status | Status indicating whether the operation is successful. Possible values:
Data type: String |
The following example shows how to remove a document reference from a record in the Incidents [incident] table.
var docReference = new sn_doc_services.DocumentReferenceService();
var result = docReference.removeDocumentReference("<docSysId>", "incident", "<tableSysId>");
gs.info(JSON.stringify(result, null, 2));
{
"message": "Deleting an entry to DocumentReference for the given docId to target table : incident, sysId : <tableSysId> is successful.",
"status": "success"
}