Skip to content

Less code than doing it by hand ​

Your job logic stays the same. Async Lib takes over enqueueing, chaining and tracking.

apex
public class SyncAccountsJob extends QueueableJob {
    public override void work() {
        // your logic
    }
}

Async.queueable(new SyncAccountsJob())
    .linkRecord(account.Id)
    .chain(new NotifyOwnersJob())
    .enqueue();
apex
public class SyncAccountsJob implements Queueable {
    public void execute(QueueableContext context) {
        // your logic
        System.enqueueJob(new NotifyOwnersJob());
        // one child per Queueable: a second enqueue here throws
        // "Too many queueable jobs". Nothing records what ran.
    }
}

System.enqueueJob(new SyncAccountsJob());

Every pattern side by side or install it.