Schedule Account Plan Category Calculation
Schedules one or multiple account plan categories for batch
calculation. It accepts up to 1000 account plan categories and schedules them for
calculation.
- Resource
-
1SCHEDULE_ACCOUNT_PLAN_CATEGORY_CALC - Available version
- 55.0
- Apex Request Example
-
1// name of the salesorg for which the job should be scheduled 2String salesOrg = '0001'; 3<namespace>.ScheduleAccountPlanCategoryCalcCallout callout = new <namespace>.ScheduleAccountPlanCategoryCalcCallout (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 = 'AccountPlanCategoryCalculation'; 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_Category__c> accountPlanCategoriesToCalculate = [ 17 SELECT Id FROM cgcloud__Account_Plan__c 18 // WHERE cgcloud__Account_Plan__r.cgcloud__Sales_Org__c = :salesOrg 19 // AND ... 20]; 21 22<namespace>.OffplatformCalloutResponse response = callout.execute(txId, job, accountPlanCategoriesToCalculate, options); 23 24if (response.status != 200) { 25 // Handle error 26}