CostPlanBatchOperations - グローバル
CostPlanBatchOperations スクリプトインクルードは、バッチ処理を使用してデマンドおよびプロジェクトの多数のコスト計画レコードを作成できるメソッドを提供します。GlideRecord の代わりにこのスクリプトインクルードを使用すると、複数のコスト計画レコードをより効率的に作成できます。
CostPlanBatchOperations.add() メソッドを使用して、任意の数のコスト計画をバッチキューに追加します。必要なすべてのコスト計画を追加したら、 CostPlanBatchOperations.process() メソッドを使用して、インスタンスでコスト計画を作成/挿入します。CostPlanBatchOperations.process() メソッドを呼び出すまで、追加要求はバッチキューに残ります (まだインスタンスには追加されません)。何らかの理由でバッチキュー内のすべてのコスト計画を削除する必要がある場合は、CostPlanBatchOperations.clear() メソッドを使用します。
このスクリプトインクルードを使用するには、PPM Standard (com.snc.financial_planning_pmo) プラグインを有効にする必要があります。
CostPlanBatchOperations - add(オブジェクト costPlan)
指定されたタスク (プロジェクトまたはデマンド) に 1 つ以上のコスト計画を追加します。このメソッドは、複数のコスト計画を作成する際に使用します。
| 名前 | タイプ | 説明 |
|---|---|---|
| costPlan | オブジェクト | 既存のタスクに追加する各コスト計画を記述する 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();