Salesforce Certified Platform Developer II — Question 188
A developer is writing code that requires making callouts to an external web service.
Which scenario necessitates that the callout be made in an @future method?
Answer options
- A. The callouts will be made in an Apex Trigger.
- B. The callouts will be made in an Apex Test class.
- C. The callout could take longer than 60 seconds to complete.
- D. Over 10 callouts will be made in a single transaction.
Correct answer: A
Explanation
The correct answer is A because Apex triggers are synchronous and cannot make callouts directly; they need to be handled asynchronously with @future methods. Option B is incorrect since callouts in test classes are allowed without needing @future. Option C is incorrect because callouts taking longer than 60 seconds would not automatically require an @future method, and option D is incorrect as there's a limit on callouts but it doesn't necessitate an @future method.