Schedule Fund Calculation

Enqueues a given list of funds for batch calculation. The calculation result is transferred back to Salesforce via the KPI Upload once the calculation is finished.

Resource 

1SCHEDULE_FUND_CALCULATION

Available version 

55.0

Apex Request Example 

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