Is it possible to make a chain of execution with Queueable? My task after running the first Queueable is to get a token (callout) and only when it is available (in Custom MetaData) to run the next Queueable to update the user data in a new call out.

1 Answer 1


The official documentation explains this, relevant detail and link below.

Chaining jobs: You can chain one job to another job by starting a second job from a running job. Chaining jobs is useful if your process depends on another process to have run first.

Chaining Jobs To run a job after some other processing is done first by another job, you can chain queueable jobs. To chain a job to another job, submit the second job from the execute() method of your queueable class. You can add only one job from an executing job, which means that only one child job can exist for each parent job. For example, if you have a second class called SecondJob that implements the Queueable interface, you can add this class to the queue in the execute() method as follows:

public class AsyncExecutionExample implements Queueable {
    public void execute(QueueableContext context) {
        // Your processing logic here       

        // Chain this job to next job by submitting the next job
        System.enqueueJob(new SecondJob());

You can’t chain queueable jobs in an Apex test. Doing so results in an error. To avoid getting an error, you can check if Apex is running in test context by calling Test.isRunningTest() before chaining jobs.


  • Looks like that I can not update Custom Meta Data and run chain Queueable in the same Queueable. Or I am missing something? Commented Aug 12, 2021 at 15:56

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .