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


---

# CostPlanBatchOperations - グローバル

# CostPlanBatchOperations - グローバル {#ariaid-title1}

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

CostPlanBatchOperations スクリプトインクルードは、バッチ処理を使用してデマンドとプロジェクトの多数のコスト計画レコードを作成できるようにするメソッドを提供します。複数のコスト計画レコードをより効率的に作成するには、 GlideRecord の代わりにこのスクリプトインクルードを使用します。

CostPlanBatchOperations.add() メソッドを使用して、任意の数のコスト計画をバッチキューに追加します。必要なすべてのコスト計画を追加したら、 CostPlanBatchOperations.process() メソッドを使用して、インスタンスでコスト計画を作成または挿入します。CostPlanBatchOperations.process() メソッドを呼び出すまで、追加要求はバッチキューに残ります (インスタンスにはまだ追加されていません)。何らかの理由でバッチキュー内のすべてのコスト計画を削除する必要がある場合は、 CostPlanBatchOperations.clear() メソッドを使用します。

このスクリプトインクルードを使用するには、PPM Standard (com.snc.financial_planning_pmo) プラグインを有効にする必要があります。

## CostPlanBatchOperations - add(オブジェクト costPlan) {#ariaid-title2}

指定されたタスク (プロジェクトまたはデマンド) に 1 つ以上のコスト計画を追加します。複数のコスト計画を作成する場合は、この方法を使用します。
処理が完了すると、コスト計画が指定されたプロジェクトまたはデマンドに挿入されます。その後、インスタンス内でそれらを表示および変更できます。詳細については、「 [プロジェクトコスト計画の作成](https://www.servicenow.com/docs/access?context=t_CreateAProjectCostPlan&version=australia&pubname=australia-it-business-management&ft:locale=en-US) 」および [「デマンドコスト計画の作成](https://www.servicenow.com/docs/access?context=t_CreateADemandCostPlan&version=australia&pubname=australia-it-business-management&ft:locale=en-US)」を参照してください。  
注:  
この方法では、インスタンスに追加するコスト計画のみを定義します。costPlanBatchOperations.process() が呼び出されるまで、コスト計画はインスタンスに挿入されません。
{#CostPlanBatch-add_A__table_ebg_mhf_kjb__entry__3}

| 名前 | タイプ | 説明 |
|-|-|-|
| コスト計画 | オブジェクト | 既存のタスクに追加する各コスト計画を説明する 1 つ以上のオブジェクトまたはオブジェクトのアレイ。 |
| costPlan.name | 文字列 | コスト計画の名前。 最大長:130 文字 |
| costPlan.task | 文字列 | このコスト計画に関連付けるプロジェクトまたはデマンドのSys_id。この値は、次のいずれかのテーブルで確認できます。 * プロジェクト \[pm_project\] * プロジェクトタスク \[pm_project_task\] * デマンド \[dmn_demand\] {#CostPlanBatch-add_A__ul_ahs_vwj_4jb} |
| costPlan.unit_cost | 番号 | 指定されたリソースの単価。 |
| costPlan.resource_type | 文字列 | このコスト計画に関連付けられた原価費目を定義するレコードのSys_id。このパラメーターに使用できる値は、コストタイプ定義 \[resource_type_definition\] テーブルで定義されます。 |
| costPlan.start_fiscal_period | 文字列 | このコスト計画に関連付ける開始会計期間を定義するレコードのSys_id。このパラメーターに使用可能な値は、会計期間 \[fiscal_period\] テーブルで定義されます。 |
| costPlan.end_fiscal_period | 文字列 | このコスト計画に関連付ける会計期間の終了を定義するレコードのSys_id。このパラメーターに使用可能な値は、会計期間 \[fiscal_period\] テーブルで定義されます。 |
| costPlan.\<optional\> | 変化あり | オプション。追加のパラメーターを渡してコスト計画に追加できます。使用可能なパラメーターは、作成するコスト計画のタイプによって異なります。 渡すことができる追加パラメーターのリストについては、コスト計画 \[cost_plan\] テーブルを参照してください。 |
[表 : 1. パラメーター]

{#CostPlanBatch-add_A__table_ebg_mhf_kjb} {#CostPlanBatch-add_A__table_fbg_mhf_kjb__entry__2}

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

{#CostPlanBatch-add_A__table_fbg_mhf_kjb}  
この例では、単純なバッチコスト計画を追加する方法を示します。

    //Define Array of Cost Plan records in JSON format
    var costPlanRecords= [];
    costPlanRecords.push({
       name:'Capital Expense',
       task:'f7a36d1bdb58001025c85a35dc96193a', // sys_id of the task
       unit_cost:1000.00, //decimal 
       resource_type:'a546eaf79330120064f572edb67ffb70', // sys_id of the cost type definition
       start_fiscal_period:'091b6e60cb111200f2de77a4634c9c2e', // sys_id of the start fiscal period record 
       end_fiscal_period:'0d1b6e60cb111200f2de77a4634c9c2f',// sys_id of the end fiscal period record 
       quantity:1 // Optional cost plan record attributes
    });
     
    var costPlanBatchOperations = new CostPlanBatchOperations();
    costPlanBatchOperations.add(costPlanRecords);
    var costPlanSysIds = costPlanBatchOperations.process();

## CostPlanBatchOperations - clear() {#ariaid-title3}

CostPlanBatchOperations.add() メソッドを使用して追加されたすべてのコスト計画オブジェクトを削除します。
注:  
このメソッドは、追加されたコスト計画に対してのみ機能します。コスト計画が処理されると、この方法では削除できません。処理済みのコスト計画は、UI から手動で削除する必要があります。
{#CostPlanBatch-clear__table_ovv_q24_kjb__entry__3}

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

{#CostPlanBatch-clear__table_ovv_q24_kjb} {#CostPlanBatch-clear__table_pvv_q24_kjb__entry__2}

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

{#CostPlanBatch-clear__table_pvv_q24_kjb}  
この例では、コスト計画を追加した後にバッチキューをクリアする方法を示します。

    //Define Array of Cost Plan records in JSON format
    var costPlanRecords= [];
    costPlanRecords.push({
       name:'Capital Expense',
       task:'f7a36d1bdb58001025c85a35dc96193a', // sys_id of the task
       unit_cost:1000.00, //decimal 
       resource_type:'a546eaf79330120064f572edb67ffb70', // sys_id of the cost type definition
       start_fiscal_period:'091b6e60cb111200f2de77a4634c9c2e', // sys_id of the start fiscal period record 
       end_fiscal_period:'0d1b6e60cb111200f2de77a4634c9c2f',// sys_id of the end fiscal period record 
       quantity:1 // Optional cost plan record attributes
    });
     
    var costPlanBatchOperations = new CostPlanBatchOperations();
    costPlanBatchOperations.add(costPlanRecords);
    var costPlanSysIds = costPlanBatchOperations.process();
    costPlanBatchOperations.clear();

## CostPlanBatchOperations:process() {#ariaid-title4}

CostPlanBatchOperations.add() メソッドを使用して追加されたすべてのコスト計画を処理し、対応するコスト計画と関連するロールアップを作成します。
コスト計画が正常に処理されると、コスト計画キューはクリアされます。
{#CostPlanBatch-process__table_ej2_dh4_kjb__entry__3}

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

{#CostPlanBatch-process__table_ej2_dh4_kjb} {#CostPlanBatch-process__table_fj2_dh4_kjb__entry__2}

| タイプ | 説明 |
|-|-|
| アレイ | 生成された各コスト計画の Sys ID。 |
[表 : 6. 返される内容]

{#CostPlanBatch-process__table_fj2_dh4_kjb}  
この例では、単純なバッチコスト計画を処理する方法を示します。

    //Define Array of Cost Plan records in JSON format
    var costPlanRecords= [];
    costPlanRecords.push({
       name:'Capital Expense',
       task:'f7a36d1bdb58001025c85a35dc96193a', // sys_id of the task
       unit_cost:1000.00, //decimal 
       resource_type:'a546eaf79330120064f572edb67ffb70', // sys_id of the cost type definition
       start_fiscal_period:'091b6e60cb111200f2de77a4634c9c2e', // sys_id of the start fiscal period record 
       end_fiscal_period:'0d1b6e60cb111200f2de77a4634c9c2f',// sys_id of the end fiscal period record 
       quantity:1 // Optional cost plan record attributes
    });
     
    var costPlanBatchOperations = new CostPlanBatchOperations();
    costPlanBatchOperations.add(costPlanRecords);
    var costPlanSysIds = costPlanBatchOperations.process();


