Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Platform Developer II All Questions

View all questions & answers for the Certified Platform Developer II exam

Exam Certified Platform Developer II topic 1 question 284 discussion

Actual exam question from Salesforce's Certified Platform Developer II
Question #: 284
Topic #: 1
[All Certified Platform Developer II Questions]

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]
Show Suggested Answer Hide Answer
Suggested Answer: B 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
AppleDash
Highly Voted 1 year, 8 months ago
Should be B. https://developer.salesforce.com/docs/atlas.en-us.soql_sosl.meta/soql_sosl/sforce_api_calls_soql_select_for_update.htm
upvoted 6 times
...
FriedConsole2000
Most Recent 8 months, 4 weeks ago
Selected Answer: B
The answer is "B" and locks it with "FOR UPDATE"
upvoted 3 times
...
Sapphire808
1 year, 1 month ago
B Same as question 286
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
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.

SaveCancel
Loading ...