Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Schedule Account Plan Calculation V2

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

1// name of the salesorg for which the job should be scheduled
2String salesOrg = '0001';
3<namespace>.ScheduleAccountPlanCalculationV2Callout callout = new <namespace>.ScheduleAccountPlanCalculationV2Callout(salesOrg);
4
5// Log Transaction Id
6String txId = <namespace>.TransactionHandler.getTransactionIdentifier();
7
8// Job object
9<namespace>.Job job = new <namespace>.Job();
10job.JobChainName = 'TPM_Calculation_Chain_<timestamp>';
11job.JobName = 'AccountPlanCalculationBasic';
12job.BatchChainType = 'default';
13job.JobThreads = 25; // ⚡ ADD: Number of parallel workers (default: 5, max: 25 on production/full copy sandbox, 3 on other sandboxes)
14
15// Account Plans in Scope
16List<cgcloud__Account_Plan__c> accountPlansToCalculate = [
17    SELECT Id FROM cgcloud__Account_Plan__c WHERE cgcloud__Sales_Org__c = :salesOrg 
18    // AND ... 
19];
20
21<namespace>.ScheduleAccountPlanCalculationV2Callout.Options options = new <namespace>.ScheduleAccountPlanCalculationV2Callout.Options();
22options.writebacksubsets = new List<String> { 'basic' };
23options.cleanupobsoletemeasures = false;
24
25
26<namespace>.OffplatformCalloutResponse response = callout.execute(txId, job, accountPlansToCalculate, options);
27
28if (response.status != 200) {
29   // Handle error
30}

BusinessPlan Calculation

1// name of the salesorg for which the job should be scheduled
2String salesOrg = '0001';
3<namespace>.ScheduleAccountPlanCalculationV2Callout callout = new <namespace>.ScheduleAccountPlanCalculationV2Callout(salesOrg);
4
5// Log Transaction Id
6String txId = <namespace>.TransactionHandler.getTransactionIdentifier();
7
8// Job object
9<namespace>.Job job = new <namespace>.Job();
10job.JobChainName = 'TPM_Calculation_Chain_<timestamp>';
11job.JobName = 'AccountPlanCalculationBusinessPlan';
12job.BatchChainType = 'default';
13job.JobThreads = 25; // ⚡ ADD: Number of parallel workers (default: 5, max: 25 on production/full copy sandbox, 3 on other sandboxes)
14
15// Account Plans in Scope
16List<cgcloud__Account_Plan__c> accountPlansToCalculate = [
17    SELECT Id FROM cgcloud__Account_Plan__c WHERE cgcloud__Sales_Org__c = :salesOrg 
18    // AND ...  
19];
20
21<namespace>.ScheduleAccountPlanCalculationV2Callout.Options options = new <namespace>.ScheduleAccountPlanCalculationV2Callout.Options();
22options.writebacksubsets = new List<String> { 'businessplan' };
23options.cleanupobsoletemeasures = false;
24
25
26<namespace>.OffplatformCalloutResponse response = callout.execute(txId, job, accountPlansToCalculate, options);
27
28if (response.status != 200) {
29   // Handle error
30}