Batch Manager
{{< loadmermaid >}}
The Batch Manager module enable an easy and powerful way to manage batch processes with thread paralelization, stats, error control and recovery mode out of the box.
The main capabilities are:
- Setup a Batch Job to execute whatever APEX Method you need.
- Set the number of parallel Threads.
- Automated Throttling mechanism to avoid hitting paralell batch limits.
- Customizable Hooks to add extra feature to the Batch Manager.
- Recovery Mode when the batch has not finished correctly.
- Ability to schedule batch executions.
- Out of the Box stats.
Batch Job
The Batch Job Detail View provides a comprehensive overview of the Batch Job, its associated threads, and execution details.

Key Sections of the Batch Job Detail View:
Job Details
In this section you can define teh configuration for a batch execution
Job Setup:
- Batchable Job Class: Name of the implementation class handling the job logic.
- Scheduled Date: Date and time the job is scheduled to run (if applicable).
- Threads: Number of parallel threads specified for the job.
- Batch Size: Number of records processed in each chunk.
High Volume Settings:
- SOQL Query: Defines the records to process using a SOQL query.
- Thread Size Threshold: Determines how many records are allocated per thread.
- Avoid Requests: Indicates if the creation of requests should be skipped during execution.
Time Limit Settings:
- Time Limit Type: Defines if there is a time limit for execution (e.g., None, Fixed).
Job Stats:
- Start Time: Timestamp indicating when the job started.
- End Time: Timestamp indicating when the job completed.
- Created By: User who created the Batch Job.
Batch Job Threads
This section lists all threads created for the Batch Job. Each thread represents a group of requests processed in parallel.
- Thread ID: Unique identifier for the thread.
- Success Ratio: Percentage of successful requests.
- Requests: Total number of requests processed by the thread.
- Status: Current status of the thread (e.g., Completed).
- Errors: Number of errors encountered during execution.
- Start Time: Time when the thread execution started.
- End Time: Time when the thread execution completed.
Related List: Batch Requests
- Displays individual requests associated with the Batch Job.
- This section was empty in this example (
Batch Requests (0)
).
Example Use Case:
Batch Job Fields Example
Field Name | Type | Required | Example | Description |
---|---|---|---|---|
Name | Autonumber | Y | JOB-000001 | The unique Batch Job identifier |
Batchable Job Class | String | Y | MyBatchableJobImplementation | The name of the BatchableJob implementation to be executed in this job |
Threads | Number | N | 4 | The number of threads to create for this job. If is left blank it will be 1. |
Retry Failed | boolean | N | true | Sets if the batch should reprocess the failed requests. You must rerun manually the Batch again. |
Scheduled Date | Datetime | N | 2023-05-23 11:00:00 | The date-time to execute this Batch Job. Keep in mind that it will be executed as soon as possible but it’s not warrantied to be executed in that exact time. |
Status | Text | Read Only | New | The Batch Job status. It’s updated automatically. |
Start Time | Date | Read Only | 2023-05-23 11:00:00 | The date-time when the execution started. |
End Time | Date | Read Only | 2023-05-23 12:00:00 | The date-time when the execution ended. |
Request | Number | Read Only | 23 | Number of requests related to the Batch Job |
Success | Number | Read Only | 10 | Number of succeeded requests |
Errors | Number | Read Only | 5 | Number of failed requests |
Success Ratio | Percentage | Read Only | 98% | Ratio of Sucess / Error records. |
% Completed | Percentage | Read Only | 98% | Number of requests completed (Success or Failed) |
Batch Request Fields
Field Name | Type | Required | Example | Description |
---|---|---|---|---|
Name | Autonumber | Y | JOB-000001 | The unique Batch Job identifier |
Input | String | Y | {} | The parameters to be passed to the BatchableJob class in JSON format. |
Status | Text | Read Only | New | The Batch Job status. It’s updated automatically. |
Message | Text | Read Only | Success! | The resulting message from the execution. It must be set by the BatachleJob class |
Scheduled Date | Datetime | N | 2023-05-23 11:00:00 | The date-time to execute this request. Keep in mind that it will be executed as soon as possible but it’s not warrantied to be executed in that exact time. |
Start Time | Date | Read Only | 2023-05-23 11:00:00 | The date-time when the request execution started. |
End Time | Date | Read Only | 2023-05-23 12:00:00 | The date-time when the request execution ended. |
Number of Retries | Number | Read Only | 2 | The number of times that the request was executed. |
Number of Threads
The Batch Manager is based in the Salesforce’s Batch functionality, and each thread is related to one Batch. This means, that the governors limits apply and you can only execute a maximun of 5 batch. If you set the Number of Threads to a higher number they will be added to apex Flex Queue.
Keep in mind that the Apex Flex Queue can only hold up to 100 batches, so the Batch Manager will cap any value higher than 100 to the maximun number of available slots in the Apex Flex Queue.
In the future, the Batch Manager will only execute up to 5 threads, and as soon as one finishes, the BatchExecutor will execute the next pending thread if there is any.