Salesforce Certified Platform Developer II — Question 90
A developer is working on code that requires a call to an external web service from a batch.
How should the developer enable this functionality?
Answer options
- A. Implement a custom System.CalloutException class
- B. Include Database.AllowCallout() in the class definition
- C. Implement an @future method for the callout, and invoke it from the batch
- D. Specify "callout=true" in the batch implementation
Correct answer: B
Explanation
The correct answer is B because including Database.AllowCallout() in the class definition permits the batch job to make callouts to external web services. Options A and C are incorrect since they do not directly enable callouts in a batch context, and option D is not a valid syntax for enabling callouts in batch classes.