Salesforce-Platform-Developer Practice Test

Salesforce Spring 25 Release
237 Questions

A Lightning component has a wired property, searchResults, that stores a list of Opportunities. Which definition of the Apex method, to which the searchResults property is wired, should be used?

A. @AuraEnabled(cacheable=true) public static List search(String term) { /* implementation*/ }

B. @AuraEnabled(cacheable=true) public List search(String term) { /*implementation*/ }

C. @AuraEnabled(cacheable=false) public static List search(String term) { /*implementation*/ }

D. @AuraEnabled(cacheable=false) public List search(String term) { /*implementation*/ }

A.   @AuraEnabled(cacheable=true) public static List search(String term) { /* implementation*/ }

Explanation:

Since the Lightning component uses a wired property, the Apex method must:

✅ Be cacheable → cacheable=true ensures improved performance by allowing the Lightning framework to store and reuse data without unnecessary Apex calls.
✅ Be static → Wired properties expect static methods that do not rely on instance-specific data.
✅ Return a List of Opportunities → Since searchResults stores a list of Opportunity records, the method must return List rather than a generic List.

Salesforce-Platform-Developer Practice-Test - Home Previous
Page 23 out of 237 Pages