Newer Version Available

This content describes an older version of this product. View Latest

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 hob 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';
13
14// Account Plans in Scope
15List<cgcloud__Account_Plan_Category__c> accountPlanCategoriesToCalculate = [
16    SELECT Id FROM cgcloud__Account_Plan__c 
17    // WHERE cgcloud__Account_Plan__r.cgcloud__Sales_Org__c = :salesOrg 
18    // AND ... 
19];
20
21<namespace>.OffplatformCalloutResponse response = callout.execute(txId, job, accountPlanCategoriesToCalculate, options);
22
23if (response.status != 200) {
24   // Handle error
25}