Schedules the calculation of account plans. Batch chains
support editable account plans. It can schedule up to 500 account plan IDs for
calculation.
Use this endpoint to calculate the Account Plan, which is handled by Customer Business Plans when creating a new project. See Calculation of Account Plans and Customer Business Plans.
Resource
SCHEDULE_ACCOUNT_PLAN_CALCULATION_V2
Available version
55.0
Request Parameters
The Job object properties are sent as part of the request. See the Scheduling Jobs parent page for a full description of the Job class and its properties, including JobThreads.
Apex Request Example
Baseline Plan Calculation
// name of the salesorg for which the job should be scheduled String salesOrg = '0001'; <namespace>.ScheduleAccountPlanCalculationV2Callout callout = new <namespace>.ScheduleAccountPlanCalculationV2Callout(salesOrg); // Log Transaction Id String txId = <namespace>.TransactionHandler.getTransactionIdentifier(); // Job object <namespace>.Job job = new <namespace>.Job(); job.JobChainName = 'TPM_Calculation_Chain_<timestamp>'; job.JobName = 'AccountPlanCalculationBasic'; job.BatchChainType = 'default'; job.JobThreads = 25; // ⚡ ADD: Number of parallel workers (default: 5, max: 25 on production/full copy sandbox, 3 on other sandboxes) // Account Plans in Scope List<cgcloud__Account_Plan__c> accountPlansToCalculate = [ SELECT Id FROM cgcloud__Account_Plan__c WHERE cgcloud__Sales_Org__c = :salesOrg // AND ... ]; <namespace>.ScheduleAccountPlanCalculationV2Callout.Options options = new <namespace>.ScheduleAccountPlanCalculationV2Callout.Options(); options.writebacksubsets = new List<String> { 'basic' }; options.cleanupobsoletemeasures = false; <namespace>.OffplatformCalloutResponse response = callout.execute(txId, job, accountPlansToCalculate, options); if (response.status != 200) { // Handle error }
BusinessPlan Calculation
// name of the salesorg for which the job should be scheduled
String salesOrg = '0001';
<namespace>.ScheduleAccountPlanCalculationV2Callout callout = new <namespace>.ScheduleAccountPlanCalculationV2Callout(salesOrg);
// Log Transaction Id
String txId = <namespace>.TransactionHandler.getTransactionIdentifier();
// Job object
<namespace>.Job job = new <namespace>.Job();
job.JobChainName = 'TPM_Calculation_Chain_<timestamp>';
job.JobName = 'AccountPlanCalculationBusinessPlan';
job.BatchChainType = 'default';
job.JobThreads = 25; // ⚡ ADD: Number of parallel workers (default: 5, max: 25 on production/full copy sandbox, 3 on other sandboxes)
// Account Plans in Scope
List<cgcloud__Account_Plan__c> accountPlansToCalculate = [
SELECT Id FROM cgcloud__Account_Plan__c WHERE cgcloud__Sales_Org__c = :salesOrg
// AND ...
];
<namespace>.ScheduleAccountPlanCalculationV2Callout.Options options = new <namespace>.ScheduleAccountPlanCalculationV2Callout.Options();
options.writebacksubsets = new List<String> { 'businessplan' };
options.cleanupobsoletemeasures = false;
<namespace>.OffplatformCalloutResponse response = callout.execute(txId, job, accountPlansToCalculate, options);
if (response.status != 200) {
// Handle error
}