Schedule Account Plan Calculation

Schedule calculation for account plans for the given account plan IDs, category IDs, and time range for a given KPI collection.

When you create a new project, use the SCHEDULE_ACCOUNT_PLAN_CALCULATION_V2 endpoint to calculate the Account Plan, which is handled by Customer Business Plans.

Note

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.

See Soft Limits of Account Plan.

Resource 

1SCHEDULE_ACCOUNT_PLAN_CALCULATION

Available version 

55.0

Request Parameters 

NameTypeDescriptionRequired or Optional
salesOrgStringID of the Salesforce org.Required
jobNameStringName of the job to be schedule for calculation.Required
processNameStringName of the process.Required
jobThreadsNumberNumber 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
batchChainStringName of the batch chain.Required
batchChainTypeStringType of the batch chain.Required
accountIdStringID of the account record. 
kpiSetIdStringID of the KPI collection record. 
yearStringTime range for a given KPI collection. 
categoryIdStringID of the category record. 

Apex Request Example 

1// Logical endpoint name
2String endpointName = 'SCHEDULE_ACCOUNT_PLAN_CALCULATION';
3// name of the salesorg for which the job should be scheduled
4String salesOrg = '0003';
5<namespace>.OffplatformCallout callout = new <namespace>.OffplatformCallout(endpointName, salesOrg);
6// Log Transaction Id
7String txId = <namespace>.TransactionHandler.getTransactionIdentifier();
8// No Url Parameters
9Map<String, String> urlParameters = new Map<String,String>();
10// Payload
11Map<String, Object> payloadParams = new Map<String, Object>();
12payloadParams.put('salesorg', salesOrg);
13payloadParams.put('processname', 'AccountPlanCalculation');
14payloadParams.put('accountids', new List<Id> {'001TC000000Nl00YAC'}); // Kroger Atlanta (Account)
15payloadParams.put('datefrom', DateTime.valueOfGmt('2022-01-01 00:00:00Z').getTime());
16payloadParams.put('datethru', DateTime.valueOfGmt('2022-12-31 00:00:00Z').getTime());
17payloadParams.put('categoryids', new List<Id> {'01tTC0000001Z52YAE'}); // Beverages (Product)
18payloadParams.put('kpisetid', 'a1aTC0000000eYlYAI'); // Kpi Set (Usage Plan, taken from Account Template)
19payloadParams.put('jobname', 'AccountPlanCalculation');
20payloadParams.put('batchchain', 'TPM_Calculation_<timestamp>');
21payloadParams.put('batchchaintype', 'default');
22payloadParams.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)
23String payload = JSON.serialize(payloadParams);
24<namespace>.OffplatformCalloutResponse response = callout.execute(txId, urlParameters, payload);
25if (response.status != 200) {
26   // Handle error and return error info to caller
27}