Skip to main content
The Async Job Coordinator runs long, multi-step Apex automation for you. You define an ordered set of steps called a Job Group. Each time the group runs, the coordinator starts every step as its own batch job, tracks progress, records failures, and retries failed records once.

What the Coordinator Stores

The coordinator uses five objects. You manage Job Groups and their Job Definitions, and fusionCore creates the rest each time a group runs.

What You Can Use It For

Use the coordinator when automation is too large or too interdependent for a single batch job. Typical patterns:
  • Multi-step, high-volume processing that must stay within Salesforce limits.
  • Chains where a later step depends on the output of an earlier step.
  • Fan-out work spread across several concurrent batches.
  • Scheduled data maintenance that needs per-record error tracking and an automatic retry.
For a complete walkthrough, see Async Job Coordinator Example.

Where to Find It

From the App Launcher: search for Job Groups, Job Definitions, Job Runs, Job Run Stages, or Job Errors. You create and edit Job Groups in the Job Group Manager, which opens when you click New or Edit on the Job Groups tab. See Managing Job Groups.

Permissions

The FC Platform - Manage Async Jobs permission set grants full access to the five objects and their tabs, and access to the Job Group Manager.

How a Run Works

A run starts from the Job Group’s schedule, or from code (see For Developers). When a run starts, fusionCore creates one Job Run in Pending status and one Pending Job Run Stage for each Job Definition. Each stage then runs as its own batch job.

Ordering Options

Each Job Definition has these settings:

Batch Capacity

The coordinator starts a stage only when a batch slot is free. It counts every Batch Apex job in the org that is Processing, Preparing, or Queued, not only its own.
  • The ceiling is the lower of the FC: Async Coordinator Max Jobs constant and 4. The shipped value is 3.
  • Salesforce keeps one slot in reserve, so the effective maximum is 4.
  • Stages that cannot start stay Pending. The coordinator checks again only when another stage of the same run finishes.
To change the limit, open Setup, go to Custom Metadata Types, open Constant, click Manage Records, and edit FC: Async Coordinator Max Jobs. The coordinator never uses more than 4 batch slots, so values above 4 have no effect.

Errors and the Automatic Retry

Two kinds of failure can occur, and they behave differently: A stage with errors ends Completed with Errors, and the run continues with the other stages. After all regular stages finish, fusionCore retries once:
  • It creates retry stages for the failed step and for every later step.
  • The failed record Ids go to the first retry stage.
  • Records that succeed on retry have their Job Errors deleted and move on to the next retry stage.
  • A retry that fails again does not trigger another retry.

Job Run Statuses

A Job Run moves through Pending, In Progress, and then Completed Successfully or Completed with Errors. It ends Completed with Errors when Number Of Errors is greater than 0. Stages use the same four values. A stage’s Completed with Errors means that stage logged errors. See Monitoring Job Runs for detail.

For Developers

Each Job Definition points to an Apex class that implements the global interface FCORE_BASE.JobExecutor. Until a developer deploys at least one such class, the Apex Class dropdown in the Job Group Manager is empty.

Class Requirements

  • Declare the class global and concrete.
  • Implement all six interface methods. Return null from the ones you do not use.

Interface Methods

Context and Result Objects

FCORE_BASE.JobRunStageContext has one member: stage, the current Job Run Stage record. It includes the stage’s Context 1 and Context 2 and the Job Run’s Global Context 1 and Global Context 2. Create a result with new FCORE_BASE.JobRunStageResult(context). Its members:

Start a Run from Code

Call FCORE_BASE.JobRunService.createAndRunJob with the Job Group’s Id:
If the group is inactive, the call fails with Cannot start job. Job Group is inactive. If the group has no Job Definitions, no run is created and fusionCore logs Failed to run job. Job Group is missing Job Definitions. For complete, working classes, see Async Job Coordinator Example.

Managing Job Groups

Create, schedule, change, and delete Job Groups.

Monitoring Job Runs

Read run statuses, stages, and errors.

Async Job Coordinator Example

Follow a complete three-step example.