Salesforce Certified Platform Developer II — Question 262
A developer wants to call an Apex Server-side Controller from a Lightning Aura Component.
What are two limitations to the data being returned by the Controller? (Choose two.)
Answer options
- A. A custom Apex Class can be returned, but only the values of public instance properties and methods annotated with @AuraEnabled are serialized and returned.
- B. Lists of Custom Apex Classes cannot be returned by Apex Controllers called by Lightning Aura Components.
- C. Basic data types are supported, but defaults, such as maximum size for a number, are defined by the objects that they map to.
- D. Only Basic data types and sObjects are supported as return types for Apex Controllers called by Lightning Aura Components.
Correct answer: A, C
Explanation
Option A is correct because only public instance properties and methods annotated with @AuraEnabled can be serialized and returned from a custom Apex Class. Option C is also correct as it highlights that while basic data types are supported, their characteristics, such as maximum size, depend on the objects they relate to. Options B and D are incorrect because Apex Controllers can return Lists of Custom Apex Classes and do support additional return types beyond just Basic data types and sObjects.