Scheduling Jobs
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:
1<namespace>.Job job = new <namespace>.Job();
2job.JobChainName = 'TPM_Calculation_Chain_' + Datetime.now().getTime();
3job.JobName = 'AccountPlanCalculationBasic';
4job.BatchChainType = 'default';
5job.JobThreads = 25; // Recommended: use maximum available workers for optimal throughput