Salesforce Certified Platform Developer II — Question 229
A developer receives an error when trying to call a global server-side method using the @remoteAction decorator.
How can the developer resolve the error?
Answer options
- A. Decorate the server-side method with (static=true)
- B. Change the function signature to be private static
- C. Decorate the server-side method with (static=false)
- D. Add static to the server-side method signature
Correct answer: D
Explanation
The correct answer is D because the server-side method needs to be declared as static for it to be callable via the @remoteAction decorator. Options A and C are incorrect as they do not fulfill the requirement of declaring the method as static. Option B is also wrong since changing the access modifier to private does not allow the method to be called remotely.