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

SCHEDULE_FUND_CALCULATION

Available version

55.0

Apex Request Example

// name of the salesorg for which the job should be scheduled
String salesOrg = '0001';
<namespace>.ScheduleFundCalculationCallout callout = new <namespace>.ScheduleFundCalculationCallout(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 = 'FundCalculation';
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__Fund__c> fundsToCalculate = [
    SELECT Id FROM cgcloud__Fund__c 
    // WHERE cgcloud__Sales_Org__c = :salesOrg 
    // AND ... 
];
<namespace>.OffplatformCalloutResponse response = callout.execute(txId, job, fundsToCalculate);
if (response.status != 200) {
   // Handle error
}