Exam PDII Topic 10 Question 14 Discussion

Actual exam question for Salesforce's PDII exam
Question #: 14
Topic #: 10
A developer is asked to look into an issue where a scheduled Apex is running into DML limits. Upon investigation, the developer finds that the number of records processed by the scheduled Apex has recently increased to more than 10,000.
What should the developer do to eliminate the limit exception error?

Suggested Answer: C Vote an answer

The best way to eliminate the limit exception error is to implement the Batchable interface. The Batchable interface allows the developer to create a class that can process large sets of data in batches, and execute logic for each batch of records. The developer can use the Database.executeBatch method to invoke the batch class, and specify the batch size and the scope of records to process. This way, the developer can avoid hitting the DML limits, as each batch of records will have its own set of governor limits. Using the @future annotation will not help, as it will only defer the execution of the method to a later time, but it will not split the records into batches, and it will still hit the DML limits. Implementing the Queueable interface will not help, as it will only allow the developer to chain asynchronous jobs, but it will not split the records into batches, and it will still hit the DML limits. Using platform events will not help, as they are used to communicate changes in data or processes across the system, but they will not split the records into batches, and they will still hit the DML limits. Reference: [Using Batch Apex], [Apex Developer Guide]

by Roberta at Jan 18, 2024, 01:48 AM

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
Nick name: Submit Cancel
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

0
0
0
10