New Year Sale 2026! Hurry Up, Grab the Special Discount - Save 25% - Ends In 00:00:00 Coupon code: SAVE25
Welcome to Pass4Success

- Free Preparation Discussions

Salesforce Certified Platform Developer II (Plat-Dev-301) Exam - Topic 2 Question 110 Discussion

Actual exam question for Salesforce's Salesforce Certified Platform Developer II (Plat-Dev-301) exam
Question #: 110
Topic #: 2
[All Salesforce Certified Platform Developer II (Plat-Dev-301) Questions]

As part of a custom interface, a developer team creates various new Lightning web components. Each of the components handles errors using toast messages. When the development is complete, all the components are added to the same Lightning page.

During acceptance testing, users complain about the long chain of toast messages that display when errors occur loading the components.

Which two techniques should the developer implement to improve the user experience?

Choose 2 answers

Show Suggested Answer Hide Answer
Suggested Answer: A, D

The scenario describes a common issue when multiple components are used on the same Lightning page and each component manages its error handling independently, leading to a 'long chain of toast messages' which can be overwhelming for users.

To improve user experience, the developers can implement the following techniques:

A . Use a Lightning web component to aggregate and display all errors: This method involves creating a centralized component responsible for handling all error messages. This component would receive error notifications from other components and then display them in a user-friendly manner. The benefit of this approach is that it provides a single, consistent interface for error messages, reducing the clutter and confusion that can be caused by multiple toasts.

D . Use public properties on each component to display the error messages: By using public properties, components can expose their error states to a parent or orchestrating component, which can then display these errors in a single, consolidated way. This avoids the issue of multiple toast notifications and allows for a more integrated error handling experience.

The other options presented are less ideal:

B . Using the window.alert() method is not recommended in a professional Salesforce environment as it is considered a disruptive way to show errors and does not align with the Salesforce Lightning design system.

C . Using a <template> tag to display in-place error messages could be a viable option for displaying error messages within the component itself, but it does not address the issue of multiple errors stacking up from different components as described in the scenario.


For building a centralized error handling component: Lightning Web Components Developer Guide - Error Handling

For implementing public properties: Lightning Web Components Developer Guide - Public Properties

Contribute your Thoughts:

0/2000 characters
Zachary
3 months ago
I love the idea of aggregating errors! Makes total sense!
upvoted 0 times
...
Nichelle
3 months ago
D? Really? That sounds like a mess waiting to happen.
upvoted 0 times
...
Eliz
3 months ago
C could work, but not sure if it's the best option.
upvoted 0 times
...
Brittni
4 months ago
B seems outdated, who uses alerts anymore?
upvoted 0 times
...
Elin
4 months ago
A is definitely the way to go for better UX.
upvoted 0 times
...
James
4 months ago
I feel like window.alert() is definitely not user-friendly, so I would rule out option B right away. It’s just too disruptive for users.
upvoted 0 times
...
Hoa
4 months ago
I practiced a similar question, and I think using public properties for error messages might not be the best approach. It could still lead to multiple alerts.
upvoted 0 times
...
Lavina
4 months ago
I'm not entirely sure, but I think using in-place error messages with the