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 

NameTypeDescriptionRequired or Optional
jobnameStringName of the job.Required
salesorgStringSales Organization name.Required
promotionidsList<Id>List of promotion IDs to calculate.Required
batchchainStringUnique batch chain name.Required
jobthreadsNumberNumber 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<namespace>.OffPlatformCallout callout = new <namespace>.OffPlatformCallout(
9    endpointName,
10    salesOrg
11);
12<namespace>.OffPlatformCalloutResponse response = callout.execute(
13    <namespace>.TransactionHandler.getTransactionIdentifier(),
14    new Map<String, String>(),
15    JSON.serialize(
16        new Map<String, Object> {
17            'jobname' => jobName,
18            'salesorg' => salesOrg,
19            'promotionids' => promosIds,
20            'batchchain' => String.format(
21                'Promotion_Batch_Transaction_{0}',
22                new List<String>{
23                    <namespace>.TransactionHandler.getTransactionIdentifier()
24                }
25            ),
26            'jobthreads' => 25  // ⚡ ADD: Number of parallel workers (default: 5, max: 25 on production/full copy sandbox, 3 on other sandboxes)
27        }
28    )
29);
30if (response.status != 200) {
31   // Handle error
32}