---
sourceDocument: Xanadu API リファレンス
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/ja-JP/xanadu/api-reference

 Release :

    - xanadu

ft:locale :

    - ja-JP

ft:publication_title :

    - Xanadu API リファレンス

ft:clusterId :

    - crapiref

bundleId :

    - crapiref

workflow :

    - Creator


---

# SystemDocument - スコープ指定、グローバル

# SystemDocument - スコープ指定、グローバル {#ariaid-title1}

* リリースバージョン: Xanadu
* 
* 更新日 2024年08月01日
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 所要時間：15分

SystemDocument API は、ドキュメント \[ds_document\] テーブルのレコードのフィールドを設定するためのメソッドを提供します。

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

ドキュメントを作成するには、[DocumentService API](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。") を使用します。

## SystemDocument - SystemDocument(文字列 docName) {#ariaid-title2}

SystemDocument オブジェクトをインスタンス化します。
{#SystemDoc-SystemDocument_S__table_o12_jrk_spb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| docName | 文字列 | ドキュメントの名前。 |
[表 : 1. パラメーター]

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

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 2. 返される内容]

{#SystemDoc-SystemDocument_S__table_p12_jrk_spb}  
次の例は、SystemDocument オブジェクトをインスタンス化し、ドキュメントレコードに複数のフィールドを設定する方法を示しています。「[DocumentService API](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。")」も参照してください。

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

出力：

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

## SystemDocument - audience(文字列 audience) {#ariaid-title3}

ドキュメントレコードの \[対象者\] フィールドを設定して、外部または内部の可用性を指定します。ドキュメント管理 フォームの \[対象者\] フィールドを示します。
{#SystemDoc-audience_S__table_o12_jrk_spb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| audience | 文字列 | ドキュメントの対象者を表す文字列。 可能な値： * external * internal {#SystemDoc-audience_S__ul_occ_ydl_spb}デフォルト：internal |
[表 : 3. パラメーター]

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

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 4. 返される内容]

{#SystemDoc-audience_S__table_p12_jrk_spb}  
次の例では、新しいドキュメントレコード内で \[対象者\] フィールドを設定する方法を示します。「[DocumentService - スコープ付き、グローバル](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。")」も参照してください。

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

出力：

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

## SystemDocument - classification(文字列 classification) {#ariaid-title4}

情報の機密性のレベルを識別するために、ドキュメントレコードの \[分類\] フィールドを設定します。ドキュメント管理 フォームの \[分類\] フィールドを示します。
{#SystemDoc-classification_S__table_o12_jrk_spb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| classification | 文字列 | ドキュメントの分類。 可能な値： * confidential * public * restricted {#SystemDoc-classification_S__ul_nk4_zfl_spb}デフォルト： public |
[表 : 5. パラメーター]

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

| タイプ | 説明 |
|-|-|
| 文字列 | SystemDocument オブジェクトの分類プロパティの値。 |
[表 : 6. 返される内容]

{#SystemDoc-classification_S__table_p12_jrk_spb}  
次の例では、新しいドキュメントレコード内の \[分類\] フィールドを設定する方法を示します。「[DocumentService API](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。")」も参照してください。

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

出力：

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

## SystemDocument - createdFromTemplate(文字列 docTemplate) {#ariaid-title5}

ドキュメントを生成する際に使用するテンプレートを設定します。ドキュメントが生成されると、指定したテンプレートがドキュメント \[ds_document_list\] テーブルの \[テンプレートから作成\] フィールドのリストに表示されます。
{#SystemDoc-createdFromTemplate_S__table_o12_jrk_spb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| docTemplate | 文字列 | ドキュメント \[ds_document_lists\] テーブルのリストにあるドキュメントの sys_id。ドキュメントで \[テンプレート\] チェックボックスがオンになっている (true) 必要があります。「[DocumentVersionService API](https://servicenow-prod.fluidtopics.net/NVAyB~FnPidkMgM40~GZCA#DocumentVersionServiceBothAPI "DocumentVersionService API は、ドキュメント バージョンを作成および削除するためのサービスを提供します。 各バージョンは、ドキュメントコンテンツを含む要素であり、単一の URL または添付ファイルを使用して提供されます。添付ファイルはドキュメントバージョン [ds_document_version] テーブルの UI でのみ追加することができ、API を使用して追加することはできません。")」も参照してください。 |
[表 : 7. パラメーター]

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

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 8. 返される内容]

{#SystemDoc-createdFromTemplate_S__table_p12_jrk_spb}  
次の例は、既存のテンプレートから新しいドキュメントレコードを作成する方法を示しています。「[DocumentService API](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。")」も参照してください。

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

出力：

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

## SystemDocument - department(文字列 docDept) {#ariaid-title6}

ドキュメントレコードの \[部門\] フィールドを設定します。
{#SystemDoc-department_S__table_o12_jrk_spb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| docDept | 文字列 | 部門 \[cmn_department\] テーブルのリストにある部門の sys_id。 |
[表 : 9. パラメーター]

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

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 10. 返される内容]

{#SystemDoc-department_S__table_p12_jrk_spb}  
次の例では、新しいドキュメントレコード内の \[部門\] フィールドを設定する方法を示します。「[DocumentService API](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。")」も参照してください。

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

出力：

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

## SystemDocument - description(文字列 description) {#ariaid-title7}

ドキュメントレコードの \[説明\] フィールドを設定します。
{#SystemDoc-description_S__table_o12_jrk_spb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| 説明 | 文字列 | ドキュメントの説明。 |
[表 : 11. パラメーター]

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

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 12. 返される内容]

{#SystemDoc-description_S__table_p12_jrk_spb}  
次の例では、ドキュメントレコード内の \[説明\] フィールドを設定する方法を示します。「[DocumentService API](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。")」も参照してください。

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

出力：

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

## SystemDocument - name(文字列 docName) {#ariaid-title8}

ドキュメントレコードの \[名前\] フィールドを設定します。
注:  
SystemDocument() コンストラクターのパラメーターで名前を設定することもできます。
{#SystemDoc-name_S__table_o12_jrk_spb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| docName | 文字列 | ドキュメントの名前。 |
[表 : 13. パラメーター]

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

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 14. 返される内容]

{#SystemDoc-name_S__table_p12_jrk_spb}  
次の例では、新しいドキュメントレコード内で \[名前\] フィールドを設定する方法を示します。「[DocumentService API](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。")」も参照してください。

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

出力：

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

## SystemDocument - owner(文字列 owner) {#ariaid-title9}

ドキュメントレコードの \[所有者\] フィールドを設定します。
{#SystemDoc-owner_S__table_o12_jrk_spb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| owner | 文字列 | ユーザー \[sys_user\] テーブルのリストにあるユーザーの sys_id。 必要なロール：admin デフォルト：現在のユーザー |
[表 : 15. パラメーター]

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

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 16. 返される内容]

{#SystemDoc-owner_S__table_p12_jrk_spb}  
次の例では、新しいドキュメントレコード内で \[所有者\] フィールドを設定する方法を示します。「[DocumentService API](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。")」も参照してください。

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

出力：

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

## SystemDocument - reviewers(文字列 reviewers) {#ariaid-title10}

ドキュメントレコードの \[レビュー担当者\] フィールドを設定します。
{#SystemDoc-reviewers_S__table_o12_jrk_spb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| reviewers | 文字列 | 1 人以上のドキュメントレビュー担当者 (sys_id ごと) のリスト。レビュー担当者はユーザー \[sys_user\] テーブルのリスト内のユーザーである必要があります。 |
[表 : 17. パラメーター]

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

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 18. 返される内容]

{#SystemDoc-reviewers_S__table_p12_jrk_spb}  
次の例では、新しいドキュメントレコード内で \[レビュー担当者\] フィールドを設定する方法を示します。「[DocumentService API](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。")」も参照してください。

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

出力：

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

## SystemDocument - state(文字列 state) {#ariaid-title11}

ドキュメントレコードの \[ステータス\] フィールドを設定します。
{#SystemDoc-state_S__table_o12_jrk_spb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| state | 文字列 | ドキュメントがワークフロー内のどこにあるかを示すドキュメントのステータス。 有効な値： * draft * submit * review * complete {#SystemDoc-state_S__ul_o3h_zbm_spb}デフォルト：draft |
[表 : 19. パラメーター]

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

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 20. 返される内容]

{#SystemDoc-state_S__table_thg_lcm_spb}  
次の例では、新しいドキュメントレコード内で \[ステータス\] フィールドを設定する方法を示します。「[DocumentService API](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。")」も参照してください。

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

出力：

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

## SystemDocument - template(ブーリアン template) {#ariaid-title12}

ドキュメントレコードがテンプレートかどうかを指定します。
{#SystemDoc-template_S__table_o12_jrk_spb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| template | ブーリアン | ドキュメントレコードがテンプレートかどうかを指定するフラグ。 有効な値： * true：このドキュメントのデフォルトバージョンはテンプレートである。 * false：このドキュメントはテンプレートではない。 {#SystemDoc-template_S__ul_pyf_cgm_spb} デフォルト値：false |
[表 : 21. パラメーター]

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

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 22. 返される内容]

{#SystemDoc-template_S__table_p12_jrk_spb}  
次の例は、ドキュメントレコードがテンプレートであることを示す方法を示しています。「[DocumentService API](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。")」も参照してください。

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

出力：

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

## SystemDocument - type(文字列 docType) {#ariaid-title13}

ドキュメントレコードの \[タイプ\] フィールドを設定します。
{#SystemDoc-type_S__table_o12_jrk_spb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| docType | 文字列 | ドキュメントのタイプ。 有効な値： * contract * guideline * policy * procedure {#SystemDoc-type_S__ul_xzq_qsl_spb}デフォルト：なし |
[表 : 23. パラメーター]

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

| タイプ | 説明 |
|-|-|
| なし |   |
[表 : 24. 返される内容]

{#SystemDoc-type_S__table_p12_jrk_spb}  
次の例では、新しいドキュメントレコード内で \[タイプ\] フィールドを設定する方法を示します。「[DocumentService API](https://servicenow-prod.fluidtopics.net/cVXg531rqJmBPmSMZyK63g#DocumentServiceBothAPI "DocumentService API は、ドキュメントを作成、削除、および更新するためのメソッドを提供します。")」も参照してください。

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

出力：

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


