Courseiva

SF-PD2 Process Automation, Logic, and Integration Practice Question

A developer is implementing a Queueable Apex job that makes a callout to an external REST service and then updates records in Salesforce. The job must handle failures gracefully and allow chaining to a second job if needed. Which two practices should the developer follow? (Choose two.)

⚠ Common exam trap

Many candidates confuse Queueable chaining with Batch Apex state or @future methods, which do not support chaining or callouts in the same way.

Answer choices

Why each option matters

Answer the question above first, then reveal the full breakdown to understand why each option is right or wrong.

Correct answer & explanation

✓

Implement the Database.AllowsCallouts interface in the Queueable class.

To make callouts from a Queueable job, the class must implement Database.AllowsCallouts. To chain a second job and handle errors gracefully, the developer should use System.enqueueJob within the execute method and implement the Finalizer interface. These two practices ensure the job can perform callouts and manage chaining and error handling as required.

Answer analysis

Option-by-option breakdown

For each option: why learners choose it and why it is or isn't the right answer here.

  • ✓

    Implement the Database.AllowsCallouts interface in the Queueable class.

    Why this is correct

    This is correct because Queueable Apex jobs that perform callouts must implement Database.AllowsCallouts. Without this interface, the job cannot make HTTP callouts to external services. The interface grants the job permission to make callouts, which are otherwise restricted in asynchronous Apex. This is a mandatory requirement for any Queueable job that includes callout logic.

  • ✗

    Use the @future annotation with (callout=true) to make the callout, and chain a new future method for subsequent processing.

    Why it's wrong here

    This is incorrect because @future methods cannot be chained; you cannot call a future method from another future method. Also, @future is not suitable for complex chaining scenarios. Queueable Apex is preferred for chaining and callouts. The @future annotation with callout=true is allowed for callouts, but chaining is not possible, so this approach fails the requirement.

  • ✗

    Use the System.schedule method to schedule the job to run at a later time, and handle errors with a try-catch block.

    Why it's wrong here

    This is incorrect because System.schedule is used for scheduling jobs with the Schedulable interface, not for chaining Queueable jobs. While try-catch can handle errors, it does not provide the same finalization capabilities as the Finalizer interface. The requirement is to chain a second job and handle failures gracefully, which is better achieved with Queueable chaining and Finalizer.

  • ✓

    Use the System.enqueueJob method to chain a new job from within the execute method, and implement the Finalizer interface to handle errors.

    Why this is correct

    This is correct because chaining a Queueable job is done by calling System.enqueueJob from within the execute method of the current job. Additionally, implementing the Finalizer interface allows the job to handle unhandled exceptions and perform cleanup or retry logic. The Finalizer is invoked when the job fails, providing a way to gracefully handle errors and optionally requeue the job.

  • ✗

    Implement the Database.Stateful interface to maintain state across chained jobs.

    Why it's wrong here

    This is incorrect because Database.Stateful is used for Batch Apex to maintain state across batches, not for Queueable Apex. Queueable jobs do not support Database.Stateful. State in Queueable jobs is maintained through instance variables, but they are not persisted across chained jobs unless explicitly passed. The requirement is about chaining and error handling, not state maintenance.

About these practice questions

Courseiva writes every SF-PD2 question from scratch — 226 in total, each with an explanation and a wrong-answer breakdown. None are copied from real exams or dumps. Learn why practice questions differ from exam dumps →

How Courseiva writes practice questions · Editorial policy

JA

Written and reviewed by Johnson Ajibi, MSc IT Security

Senior Network & Security Engineer · founder of Courseiva

Last reviewed September 2026 · checked against the official Salesforce exam blueprint

This SF-PD2 practice question is part of Courseiva's free Salesforce certification practice question bank. Courseiva provides original exam-style practice questions with explanations, topic-based practice, mock exams, readiness tracking, and study analytics to help learners prepare for the SF-PD2 exam.