---
schema_version: "1"
id: 7e3f44be3218d121dcb148fa3e75749133c7a5373569bd95d5f87d097f05ebef
title: Scheduling Jobs
collection: legacydeveloper
version: current
locale: en-us
portal_url: https://docs.salesforce.com/legacydeveloper/current/en-us/retail_api/cgtpm_scheduling_jobs.md
canonical_url: https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_scheduling_jobs.htm
source_site: developer.salesforce.com
content_type: documentation
content_hash: 3573c60ba66058c164bec49cff79aa55a1223fd7a34857c48febe28e2d312233
description: Most of the scheduling job endpoints use the Job Chain Process Flow.
---
# Scheduling Jobs

Most of the scheduling job endpoints use the Job Chain Process Flow.

The Job Chain Process Flow provides a solution for the execution of several workers (jobs) that have dependencies between them. For example, one job requires the completion of another job before beginning its execution.

## Worker Configuration (jobThreads)

Most scheduling endpoints accept a jobThreads parameter (or use the JobThreads property of the Job class) that controls the number of parallel workers the off-platform processing service uses to process the scheduled job items.

**Important:** Setting this parameter correctly can have a significant impact on batch processing throughput and duration.

| Setting | Value |
| --- | --- |
| Default (when omitted) | 5 workers |
| Maximum on production and full copy sandbox orgs | 25 workers |
| Maximum on other sandbox orgs | 3 workers |

**Recommendation:** Always set jobThreads to 25 to maximize throughput. The processing service automatically caps the value to the environment's configured maximum (25 on production and full copy sandbox orgs, 3 on other sandbox orgs), so setting 25 is always safe.

The effective number of workers is: min(jobThreads, environment maximum, number of job items).

## The Job Class

Several scheduling endpoints use the <namespace>.Job class to pass job parameters. This global Apex class contains the following properties:

| Property | Type | Description | Required |
| --- | --- | --- | --- |
| JobChainName | String | Unique name identifying the job chain. Typically includes a timestamp for uniqueness (e.g., 'TPM\_Calculation\_Chain\_' + Datetime.now().getTime()). | Yes |
| JobName | String | Name of the specific job within the chain (e.g., 'PromotionCalculation', 'AccountPlanCalculationBasic'). | Yes |
| BatchChainType | String | Type of the batch chain. Default: 'default'. | No |
| JobThreads | Integer | Number of parallel workers. Default: 5 (applied by the backend if not set). Maximum: 25 (production and full copy sandbox) / 3 (other sandboxes). Recommended value: 25. | No (but strongly recommended) |
| JobModes | List<String> | Processing modes for the job. | No |
| Extra | Map<String, Object> | Additional job properties. | No |

**Example:**

<namespace>.Job job = new <namespace>.Job();
job.JobChainName = 'TPM\_Calculation\_Chain\_' + Datetime.now().getTime();
job.JobName = 'AccountPlanCalculationBasic';
job.BatchChainType = 'default';
job.JobThreads = 25; // Recommended: use maximum available workers for optimal throughput

- **[Abort a Job Chain](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_abort_job_chain.htm)**  
    Stops the running job chain worker for a sales org.
- **[Begin Job Scheduling Transaction](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_begin_job_sch_transaction.htm)**  
    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.
- **[Commit Job Scheduling Transaction](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_commit_job_sch_transaction.htm)**  
    Explicitly commit an open scheduling transaction for a job in a job chain.
- **[Schedule Account Plan Calculation](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_schedule_account_plan_calculation.htm)**  
    Schedule calculation for account plans for the given account plan IDs, category IDs, and time range for a given KPI collection.
- **[Schedule Account Plan Calculation V2](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_schedule_account_plan_calculation_v2.htm)**  
    Schedules the calculation of account plans. Batch chains support editable account plans. It can schedule up to 500 account plan IDs for calculation.
- **[Schedule Account Plan Category Calculation](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_schedule_account_plan_category_calc.htm)**  
    Schedules one or multiple account plan categories for batch calculation. It accepts up to 1000 account plan categories and schedules them for calculation.
- **[Schedule Adhoc Promotion Calculation](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_schedule_adhoc_promotion_calc.htm)**  
    Schedules one promotion for off-platform calculation in an ad-hoc transaction.
- **[Schedule Fund Calculation](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_schedule_fund_calc.htm)**  
    Enqueues a given list of funds for batch calculation. The calculation result is transferred back to Salesforce via the KPI Upload once the calculation is finished.
- **[Schedule Global Account Product List](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_schedule_global_account_prod_list.htm)**  
    Schedules a job to update the global account product list.
- **[Schedule Promotion Calculation](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_schedule_promotion_calc.htm)**  
    Enqueues promotion jobs for batch calculation based on the promotion IDs.
- **[Schedule Rate Based Funding Calculation](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_schedule_rate_based_funding_calc.htm)**  
    Schedules a collection of Rate Based Funding (RBF) Objects for calculation.
- **[Schedule Reorganization](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_schedule_reorganization.htm)**  
    Performs off-platform data cleanup and reorganization. Promotions in Salesforce that are deleted, inactive, or cancelled are removed from off-platform data. Additionally, softly deleted measure data is hard deleted.
- **[Schedule SF Data Sync](https://developer.salesforce.com/docs/atlas.en-us.retail_api.meta/retail_api/cgtpm_schedule_sfdata_sync.htm)**  
    Schedules a data sync from Salesforce to the off-platform database.