---
sourceDocument: オーストラリア API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/api-reference

 Release :

    - australia

ft:locale :

    - ja-JP

ft:publication_title :

    - オーストラリア API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# DocumentReferenceService:スコープ対象、グローバル

# DocumentReferenceService:スコープ対象、グローバル {#ariaid-title1}

* リリースバージョン: Australia
* 
* 更新日 2026年03月12日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：5分

DocumentReferenceService API は、インシデント \[incident\] テーブルやナレッジ \[kb_knowledge\] テーブルなどのターゲットテーブル内のドキュメント参照を管理するためのメソッドを提供します。ドキュメント参照を使用して、情報をレコードに関連付けることができます。

この API は ドキュメント管理 プラグイン (com.snc.platform_document_management) を必要とし、 `sn_doc_services` 名前空間内で提供されます。詳細については、「 [ドキュメント サービス」](https://www.servicenow.com/docs/access?context=document-services-landing-page&version=australia&pubname=australia-servicenow-platform&ft:locale=en-US)を参照してください。  
次の API を使用すると、ドキュメントを定義および管理できます。

* [SystemDocument](https://servicenow-prod.fluidtopics.net/9ce9i4EAQs4raWb40gESaQ#SystemDocumentBothAPI "SystemDocument API は、ドキュメント [ds_document] テーブルのレコードのフィールドを設定するためのメソッドを提供します。") -- ドキュメントオブジェクトを定義します。
* [DocumentService](https://servicenow-prod.fluidtopics.net/42pJxIGWieLl1MkhQd16Fg#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。") -- ドキュメントを追加、更新、または削除します。
{#DocumentReferenceServiceBothAPI__ul_krc_vmf_vpb}

## DocumentReferenceService:DocumentReferenceService() {#ariaid-title2}

DocumentReferenceService オブジェクトをインスタンス化します。
{#DRS-DocumentReferenceService__table_zw5_mcg_tpb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| なし |   |   |
[表 : 1. パラメーター]

{#DRS-DocumentReferenceService__table_zw5_mcg_tpb}  
次の例は、 DocumentReferenceService オブジェクトをインスタンス化する方法を示しています。

    var result = new sn_doc_services.DocumentReferenceService();

## DocumentReferenceService:addDocumentReference(文字列 docSysId, 文字列 targetTable, 文字列 tableSysId) {#ariaid-title3}

ターゲットテーブルレコードにドキュメント参照を追加します。
{#DRS-addDocumentReference_S_S_S__table_w4z_2cg_tpb__entry__3}{#DRS-addDocumentReference_S_S_S__ph_docserv_parm_docID}

| 名前 | タイプ | 説明 |
|-|-|-|
| docSysID | 文字列 | ドキュメント \[ds_document\] テーブル内のドキュメントレコードのSys_id。 |
| targetTable | 文字列 | ドキュメント参照を提供するターゲットテーブルの名前。 |
| tableSysId | 文字列 | ドキュメント参照を追加するターゲットテーブルレコードのSys_id。 |
[表 : 2. パラメーター]

{#DRS-addDocumentReference_S_S_S__table_w4z_2cg_tpb} {#DRS-addDocumentReference_S_S_S__table_x4z_2cg_tpb__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクト | ドキュメント参照 \[ds_document_reference\] テーブル内の新しいレコードのSys_idと成功メッセージ。それ以外の場合はエラーメッセージ。 { "message": "String", "status": "String" } {#DRS-addDocumentReference_S_S_S__api_docserv_codeblock_dets} |
| \<Object\>.message | 成功またはエラーを確認するメッセージ。 成功した場合、ドキュメント参照が追加されたレコードのsys_idが含まれます。 データタイプ：文字列 |
| \<Object\>.status | 操作が成功したかどうかを示すステータス。 可能な値： * 成功:操作は成功しました。 * failure:操作は成功しませんでした。messageに詳細が表示されます。 {#DRS-addDocumentReference_S_S_S__ul_rlv_5cv_j4b} データタイプ：文字列 |
[表 : 3. 返される内容]

{#DRS-addDocumentReference_S_S_S__table_x4z_2cg_tpb}  
次の例は、インシデント \[incident\] テーブルのレコードにドキュメント参照を追加する方法を示しています。

    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(文字列 docSysId, 文字列 targetTable, 文字列 tableSysId) {#ariaid-title4}

ドキュメント参照 \[ds_document_reference\] テーブルからドキュメント参照を削除します。
{#DRS-removeDocumentReference_S_S_S__table_w4z_2cg_tpb__entry__3}{#DRS-removeDocumentReference_S_S_S__ph_docserv_parm_docID}

| 名前 | タイプ | 説明 |
|-|-|-|
| docSysID | 文字列 | ドキュメント \[ds_document\] テーブル内のドキュメントレコードのSys_id。 |
| targetTable | 文字列 | ドキュメント参照を含むテーブルの名前。この情報は、ドキュメント参照 \[ds_document_reference\] テーブルのドキュメントとともに一覧表示されます。 |
| tableSysId | 文字列 | ドキュメントの参照元となるレコードのSys_id。ドキュメント参照 \[ds_document_reference\] テーブルで、ドキュメントとともに一覧表示されている関連情報を見つけることができます。 |
[表 : 4. パラメーター]

{#DRS-removeDocumentReference_S_S_S__table_w4z_2cg_tpb} {#DRS-removeDocumentReference_S_S_S__table_x4z_2cg_tpb__entry__2}

| タイプ | 説明 |
|-|-|
| オブジェクト | 成功メッセージ。それ以外の場合はエラーメッセージ。 { "message": "String", "status": "String" } {#DRS-removeDocumentReference_S_S_S__api_docserv_codeblock_dets} |
| \<Object\>.message | 成功またはエラーを確認するメッセージ。 成功した場合、ドキュメント参照が削除されたレコードのsys_idが含まれます。 データタイプ：文字列 |
| \<Object\>.status | 操作が成功したかどうかを示すステータス。 可能な値： * 成功:操作は成功しました。 * failure:操作は成功しませんでした。messageに詳細が表示されます。 {#DRS-removeDocumentReference_S_S_S__ul_rlv_5cv_j4b} データタイプ：文字列 |
[表 : 5. 返される内容]

{#DRS-removeDocumentReference_S_S_S__table_x4z_2cg_tpb}  
次の例は、インシデント \[incident\] テーブルのレコードからドキュメント参照を削除する方法を示しています。

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


