Schedule calculation for account plans for the given account plan
IDs, category IDs, and time range for a given KPI collection.
A batch process is started to calculate and write back values for an account plan. The batch processes the products, retrieves measure data, initializes a calculation based on the KPI configuration, and generates write back data based on the outcome. For more information on the product resolution, see /Products/GetProducts.
Soft limits:
- Maximum number of months based on TradeCalMaxNumberMonths. Default value is 48.
- Maximum number of accounts based on AccountLoaderMaxNumberOfAccounts. Default value is 1000.
- Maximum number of categories based on AccountLoaderMaxNumberOfCategories. Default value is 50.
- Maximum number of KPI Plans based on KpiSetMaxKPIPlan. Default value is 130.
- Maximum number of writeback KPI plans based on KpiSetMaxWritebackKPIPlan. Default value is 70.
- Maximum number of KPI Promotions based on KpiSetMaxKPIPromotion. Default value is 130.
- Maximum number of writeback KPI Promotions based on KpiSetMaxWritebackKPIPromotion. Default value is 70.
- Maximum number of KPI SubAccounts based on KpiSetMaxSubAccountsKPI. Default value is 10.
Resource
SCHEDULE_ACCOUNT_PLAN_CALCULATION
Available version
55.0
Request Parameters
| Name | Type | Description | Required or Optional |
|---|---|---|---|
| salesOrg | String | ID of the Salesforce org. | Required |
| jobName | String | Name of the job to be schedule for calculation. | Required |
| processName | String | Name of the process. | Required |
| jobThreads | Number | Number of parallel workers (threads) to process the job items. Controls batch processing throughput. Default: 5. Maximum: 25 (production and full copy sandbox) / 3 (other sandboxes). Recommended: 25. The system automatically caps the value to the environment's maximum. | Required |
| batchChain | String | Name of the batch chain. | Required |
| batchChainType | String | Type of the batch chain. | Required |
| accountId | String | ID of the account record. | |
| kpiSetId | String | ID of the KPI collection record. | |
| year | String | Time range for a given KPI collection. | |
| categoryId | String | ID of the category record. |
Apex Request Example
// Logical endpoint name String endpointName = 'SCHEDULE_ACCOUNT_PLAN_CALCULATION'; // name of the salesorg for which the job should be scheduled String salesOrg = '0003'; <namespace>.OffplatformCallout callout = new <namespace>.OffplatformCallout(endpointName, salesOrg); // Log Transaction Id String txId = <namespace>.TransactionHandler.getTransactionIdentifier(); // No Url Parameters Map<String, String> urlParameters = new Map<String,String>(); // Payload Map<String, Object> payloadParams = new Map<String, Object>(); payloadParams.put('salesorg', salesOrg); payloadParams.put('processname', 'AccountPlanCalculation'); payloadParams.put('accountids', new List<Id> {'001TC000000Nl00YAC'}); // Kroger Atlanta (Account) payloadParams.put('datefrom', DateTime.valueOfGmt('2022-01-01 00:00:00Z').getTime()); payloadParams.put('datethru', DateTime.valueOfGmt('2022-12-31 00:00:00Z').getTime()); payloadParams.put('categoryids', new List<Id> {'01tTC0000001Z52YAE'}); // Beverages (Product) payloadParams.put('kpisetid', 'a1aTC0000000eYlYAI'); // Kpi Set (Usage Plan, taken from Account Template) payloadParams.put('jobname', 'AccountPlanCalculation'); payloadParams.put('batchchain', 'TPM_Calculation_<timestamp>'); payloadParams.put('batchchaintype', 'default'); payloadParams.put('jobthreads', 25); // ⚡ CHANGE from 1 → 25: use maximum workers for optimal throughput (default: 5, max: 25 on production/full copy sandbox, 3 on other sandboxes) String payload = JSON.serialize(payloadParams); <namespace>.OffplatformCalloutResponse response = callout.execute(txId, urlParameters, payload); if (response.status != 200) { // Handle error and return error info to caller }