Salesforce Certified Data Architect — Question 42
Universal Containers (UC) owns a complex Salesforce org with many Apex classes, triggers, and automated processes that will modify records if available. UC has identified that, in its current development state, UC runs chance of encountering race conditions on the same record.
What should a data architect recommend to guarantee that records are not being updated at the same time?
Answer options
- A. Embed the keywords FOR UPDATE after SOQL statements.
- B. Refactor or optimize classes and triggers for maximum CPU performance.
- C. Migrate programmatic logic to processes and flows.
- D. Disable classes or triggers that have the potential to obtain the same record.
Correct answer: A
Explanation
The correct answer is A because using the FOR UPDATE clause in SOQL prevents multiple transactions from modifying the same record at the same time by locking the record until the transaction is completed. Options B and C do not address the issue of race conditions directly, and option D could lead to loss of necessary functionality or business logic.