Salesforce Certified Platform Developer II — Question 39
A company needs to automatically delete sensitive information after seven years. This could delete almost a million records every day.
How can this be achieved?
Answer options
- A. Use aggregate functions to query for records older than seven years, and then delete the AggregateResult objects
- B. Perform a SOSL statement to find records older than 7 years, and then delete the entire result set
- C. Schedule a batch Apex process to run every day that queries and deletes records older than seven years
- D. Schedule an @future process to query records older than seven years, and then recursively invoke itself in 1,000 record batches to delete them
Correct answer: A
Explanation
The correct answer is A because using aggregate functions allows for efficient querying of records that are older than seven years and enables the deletion of those identified records. Options B and D are less efficient because they do not utilize aggregate functions for bulk deletion and may lead to performance issues. Option C, while effective for deletion, does not leverage the power of aggregate functions to streamline the process.