Certified Platform Developer II Exam QuestionsBrowse all questions from this exam

Certified Platform Developer II Exam - Question 200


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

Show Answer
Correct Answer: ABC

Calling a method imperatively from a Lightning web component is required in two scenarios. First, when calling a method that makes a web service callout, as web service callouts cannot be used with @wire. Second, when calling a method that is not annotated with cacheable=true, since such methods cannot be cached and require imperative handling to manage the timing of the call.

Discussion

2 comments
Sign in to comment
AppleDash
Feb 26, 2023

https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.apex_call_imperative

aregasOptions: BD
May 21, 2024

https://developer.salesforce.com/docs/component-library/documentation/en/lwc/lwc.apex_call_imperative In the following scenarios, you must call an Apex method imperatively as opposed to using @wire: To call a method that isn’t annotated with cacheable=true, which includes any method that inserts, updates, or deletes data. To control when the invocation occurs. To work with objects that aren’t supported by User Interface API, like Task and Event. To call a method from an ES6 module that doesn’t extend LightningElement