Salesforce Platform Developer I (legacy) — Question 293

Which two scenarios require an Apex method to be called imperatively from a Lightning web component? (Choose two.)

Answer options

Correct answer: A, D

Explanation

The correct answers are A and D because calling a method that performs a web service callout (A) requires an imperative call due to the asynchronous nature of callouts. Additionally, if a method is external to the main controller (D), it also necessitates imperative invocation to properly handle the context. Options B and C do not require imperative calls as they can be invoked declaratively.