Salesforce Certified Platform Developer II — Question 279
Users report that a button on a custom Lightning web component is not working. However, there are no other details provided.
What should the developer use to ensure error messages are properly displayed?
Answer options
- A. Add thetag to the component.
- B. Add a try-catch block surrounding the DML statement.
- C. Use the Database method with allOrNone set to false.
- D. Add JavaScript and HTML to display an error message.
Correct answer: D
Explanation
The correct answer is D because adding JavaScript and HTML allows the developer to create a user-friendly way to display error messages when the button does not function as expected. Options A, B, and C do not directly address the need for user feedback regarding errors in a way that informs users of the issues they encounter.