CostPlanBatchOperations - グローバル
CostPlanBatchOperations スクリプトインクルードは、バッチ処理を使用してデマンドとプロジェクトの多数のコスト計画レコードを作成できるようにするメソッドを提供します。複数のコスト計画レコードをより効率的に作成するには、 GlideRecord の代わりにこのスクリプトインクルードを使用します。
CostPlanBatchOperations.add() メソッドを使用して、任意の数のコスト計画をバッチキューに追加します。必要なすべてのコスト計画を追加したら、 CostPlanBatchOperations.process() メソッドを使用して、インスタンスでコスト計画を作成または挿入します。CostPlanBatchOperations.process() メソッドを呼び出すまで、追加要求はバッチキューに残ります (インスタンスにはまだ追加されていません)。何らかの理由でバッチキュー内のすべてのコスト計画を削除する必要がある場合は、 CostPlanBatchOperations.clear() メソッドを使用します。
このスクリプトインクルードを使用するには、PPM Standard (com.snc.financial_planning_pmo) プラグインを有効にする必要があります。
CostPlanBatchOperations - add(オブジェクト costPlan)
指定されたタスク (プロジェクトまたはデマンド) に 1 つ以上のコスト計画を追加します。複数のコスト計画を作成する場合は、この方法を使用します。
| 名前 | タイプ | 説明 |
|---|---|---|
| コスト計画 | オブジェクト | 既存のタスクに追加する各コスト計画を説明する 1 つ以上のオブジェクトまたはオブジェクトのアレイ。 |
| costPlan.name | 文字列 | コスト計画の名前。 最大長:130 文字 |
| costPlan.task | 文字列 | このコスト計画に関連付けるプロジェクトまたはデマンドのSys_id。この値は、次のいずれかのテーブルで確認できます。
|
| 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] テーブルを参照してください。 |
| タイプ | 説明 |
|---|---|
| なし |
この例では、単純なバッチコスト計画を追加する方法を示します。
//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.add() メソッドを使用して追加されたすべてのコスト計画オブジェクトを削除します。
| 名前 | タイプ | 説明 |
|---|---|---|
| なし |
| タイプ | 説明 |
|---|---|
| なし |
この例では、コスト計画を追加した後にバッチキューをクリアする方法を示します。
//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()
CostPlanBatchOperations.add() メソッドを使用して追加されたすべてのコスト計画を処理し、対応するコスト計画と関連するロールアップを作成します。
コスト計画が正常に処理されると、コスト計画キューはクリアされます。
| 名前 | タイプ | 説明 |
|---|---|---|
| なし |
| タイプ | 説明 |
|---|---|
| アレイ | 生成された各コスト計画の Sys ID。 |
この例では、単純なバッチコスト計画を処理する方法を示します。
//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();