Refer to the code snippet below: A custom object called Credit_Memo_c exists in a Salesforce environment. As part of a new feature development that retrieves and manipulates this type of record, the developer needs to ensure race conditions are prevented when a set of records are modified within an Apex transaction. In the preceding Apex code, how can the developer alter the query statement to use SOQL features to prevent race conditions within a transaction?
A. [Select Id, Name, Amount_c FROM Credit_Memo_c WHERE Customer_Id_c = :customerId LIMIT 50 FOR VIEW]
B. [Select Id, Name, Amount_c FROM Credit_Memo_c WHERE Customer_Id_c = :customerId LIMIT 50 FOR UPDATE]
C. [Select Id, Name, Amount_c FROM Credit_Memo_c WHERE Customer_Id_c = :customerId USING SCOPE LIMIT 50]
D. [Select Id, Name, Amount_c FROM Credit_Memo_c WHERE Customer_Id_c = :customerId LIMIT 50 FOR REFERENCE]
Suggest answer: B
Reference:
No comments:
Please share to make the community better.