Note: This release is in preview. Features described here don’t become generally available until the latest general availability date that Salesforce announces for this release. Before then, and where features are noted as beta, pilot, or developer preview, we can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features.

Schedule Promotion Calculation

Enqueues promotion jobs for batch calculation based on the promotion IDs.
Soft limits:
  • Maximum number of promotions in a promotion loader based on PromotionLoaderMaxNumberOfPromotions. Default value is 1000.
Resource
1SCHEDULE_PROMOTION_CALCULATION
Available version
55.0
Request Parameters
Name Type Description Required or Optional
jobname String Name of the job. Required
salesorg String Sales Organization name. Required
promotionids List<Id> List of promotion IDs to calculate. Required
batchchain String Unique batch chain name. Required
jobthreads Number Number of parallel workers. Default: 5. Maximum: 25 (production and full copy sandbox) / 3 (other sandboxes). Recommended: 25. Optional (but strongly recommended)
Apex Request Example
1// Endpoint name
2String endpointName = 'SCHEDULE_PROMOTION_CALCULATION';
3// Sales Organization name
4String salesOrg = '0001';
5// 
6String jobName = '<PromotionCalculationJobName>';
7Set<Id> promosIds = new Set<Id>{'<promotionId_1>', '<promotionId_2>'};
8
9<namespace>.OffPlatformCallout callout = new <namespace>.OffPlatformCallout(
10    endpointName,
11    salesOrg
12);
13
14<namespace>.OffPlatformCalloutResponse response = callout.execute(
15    <namespace>.TransactionHandler.getTransactionIdentifier(),
16    new Map<String, String>(),
17    JSON.serialize(
18        new Map<String, Object> {
19            'jobname' => jobName,
20            'salesorg' => salesOrg,
21            'promotionids' => promosIds,
22            'batchchain' => String.format(
23                'Promotion_Batch_Transaction_{0}',
24                new List<String>{
25                    <namespace>.TransactionHandler.getTransactionIdentifier()
26                }
27            ),
28            'jobthreads' => 25  // ⚡ ADD: Number of parallel workers (default: 5, max: 25 on production/full copy sandbox, 3 on other sandboxes)
29        }
30    )
31);
32if (response.status != 200) {
33   // Handle error
34}