A Salesforce org has more than 50,000 contacts. A new business process requires a calculation that aggregates data from all of these contact records. This calculation needs to run once a day after business hours.
which two steps should a developer take to accomplish this?
Choose 2 answers
Correct Answer: B,C
When dealing with large datasets and the need to perform complex calculations or data aggregation, batch Apex and scheduling are typically used to efficiently process records in batches and to execute the process during off-peak hours.
Option B is correct because using the @future annotation allows you to run methods in the background, but it is not suitable for operations that need to process more than 50,000 records, which is the governor limit for future methods.
Option C is correct because implementing the Schedulable interface allows you to schedule the class to run at specified times, such as after business hours, which is a requirement for this scenario.
Option A is incorrect because Queueable is typically used for chaining jobs and handling asynchronous processing of individual transactions, not for processing large datasets at scheduled times.
Option D is incorrect because the Database.Batchable interface is what's needed for processing large datasets, not Database.Stateful. The Database.Stateful interface is used to maintain state across batch job transactions.
References:
Salesforce Developer Documentation on Using Batch Apex: Using Batch Apex Salesforce Developer Documentation on Scheduling Apex: Scheduling Apex
Recent Comments (The most recent comments are at the top.)
You need to process over 50,000 Contact records and run it once daily after business hours, so your solution must support:
Large data volumes → requires Batch Apex
Scheduled execution → requires Scheduled Apex
✅ D. Database.Batchable
Allows you to process millions of records in manageable chunks (default 200 per batch).
Perfect for aggregation, updates, or any heavy processing.
✅ C. Schedulable
Allows you to schedule a class to run at a specific time (e.g., after business hours daily).
You schedule the batch job using System.schedule(...)
❌ B. @future annotation
Has a limit of 50 records per method call
Not designed for large data processing
Cannot be scheduled directly
❌ A. Queueable interface
Better than @future but still not suited for massive record volumes
Not ideal when working with more than 50,000 records
can you please correct the answer . it should be schedulable with batch Apex. not future method
Option C is correct because implementing the Schedulable interface allows you to schedule the class to run at specified times, such as after business hours, which is a requirement for this scenario.
Option D is correct because the Database.Batchable interface is what's needed for processing large datasets like morethan 50K records.