Newer Version Available

This content describes an older version of this product. View Latest

Begin Job Scheduling Transaction

Begin a scheduling transaction for a job in a job chain. The job either starts an open transaction (if the number of job items is not announced) that must be explicitly committed to, or communicates the expected number of job items to the off-platform system.

Optionally, a scheduling timeout between 30 seconds and 15 minutes can be specified. The default is 5 minutes. This is the time when the scheduling processes must provide the job items. Timeout is calculated from the last time job items were added to the transaction.

Resource
1BEGIN_JOB_SCHEDULING_TRANSACTION
Available version
55.0
Request Parameters
Name Type Description Required or Optional
jobChain String ID of the job chain record. Required
jobId String ID of the job record for which scheduling transaction is to be started. Required
Apex Request Example

PromotionImport is used when you schedule a top promotion by grouping the imported promotions.

1<namespace>.BeginPromotionImportCallout callout = new <namespace>.BeginPromotionImportCallout();
2
3// Import Id, the promotion import is grouped under this ID
4String importId = '12345678-1234-1234-1234-123456789012'; 
5// Number of promotions to be imported
6Integer nrOfItems = 100;
7// Timeout in seconds: number of seconds between two schedule promotion callouts
8// for this import
9Integer timeout = 400;
10
11<namespace>.OffplatformCalloutResponse response = callout.execute(importId, nrOfItems, timeout);
12
13if (response.status != 200) {
14   // Handle error
15}

Generic is used in the calculation chain flow.

1// name of the salesorg for which the job must be scheduled
2String salesOrg = '0001';
3<namespace>.JobSchedulingBeginCallout callout = new <namespace>.JobSchedulingBeginCallout(salesOrg);
4
5// Log Transaction Id
6String txId = <namespace>.TransactionHandler.getTransactionIdentifier();
7
8// Job object
9<namespace>.Job job = new <namespace>.Job();
10job.JobChainName = 'TPM_Calculation_Chain_<timestamp>';
11job.JobName = 'PromotionCalculation';
12
13// Timeout in seconds: number of seconds between two schedule promotion callouts
14// for this import
15Integer timeout = 350;
16
17<namespace>.OffplatformCalloutResponse response = callout.execute(txId, job, timeout);
18
19if (response.status != 200) {
20   // Handle error
21}