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
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
A developer is working on an integration between Salestorce and an external system. The integration requires sending a large amount of data to the external systern, which can cause long response times and timeouts.
To optimize the performance and avoid timeouts, which technique should be used?
Implementing an asynchronous callout using the Continuation class is the optimal solution to handle long response times and avoid timeouts in Salesforce. It allows the Apex code to make a long-running request to an external service and free up the thread to serve other requests.
A developer created and tested a Visualforce page in their developer sandbox, but now receives reports that user encounter view state errors when using it in production.
What should the developer ensure to correct these errors?
The view state in Visualforce represents the state of the page - including the components, field values, and controller state. This error usually occurs when the page's view state becomes too large. To resolve this issue:
C . Ensure variables are marked as transient: The transient keyword in Apex can be used to declare instance variables that should not be part of the view state and therefore not be saved. This is especially useful for large data that does not need to be maintained across postbacks.
Marking properties as private (Option B) or ensuring queries do not exceed governor limits (Option A) might be best practices, but they do not directly impact the view state size. Ensuring profiles have access to the Visualforce page (Option D) is a matter of visibility and access, not related to view state errors.
Salesforce Developer Documentation on View State: Visualforce View State
Which two best practices should the developer implement to optimize this code? Choose 2 answers
To optimize the code in question, it's important to follow best practices that reduce the number of SOQL queries and DML statements within loops, as these can quickly consume governor limits and lead to inefficiencies. Option C is correct because using a collection to hold records and performing a single DML operation outside of loops reduces the number of DML operations, which is a best practice for bulkifying code in Salesforce. Option D is also correct because querying records outside of a loop prevents hitting SOQL governor limits and makes the code more efficient. Options A and B are not correct in the context provided, as there isn't enough information to determine if changing the trigger context is necessary, and removing the DML statement altogether may not be feasible if the logic requires data to be persisted.
Reference
Apex Best Practices: Apex Developer Guide Best Practices
Universal Containers uses Big Objects to store almost a billion customer transactions called Customer_Transaction__b.
These are the fields on Customer_Transaction__b:
Account__c -
Program__c -
Points_Earned__c -
Location__c -
Transaction_Date__c -
The following fields have been identified as Index Fields for the Customer_Transaction__b object: Account__c, Program__c, and Transaction_Date__c.
Which SOQL query is valid on the Customer_Transaction__b Big Object?
The valid SOQL query on a Big Object must match the indexed fields exactly. Since Account__c, Program__c, and Transaction_Date__c are the indexed fields, the SOQL query must specify those fields exactly in the WHERE clause, including exact match conditions (no LIKE or INCLUDES).
Olivia Jones
1 day agoDaniel Gonzalez
14 days agoGeorge Walker
3 days agoRachel Nguyen
3 days agoMargaret Martin
4 days agoRonald Bailey
5 days agoKimberly Williams
3 days agoIndia
1 month agoCiara
1 month agoHector
2 months agoLatanya
2 months agoGlennis
2 months agoSamuel
2 months agoPenney
3 months agoGussie
3 months agoBecky
3 months agoErick
3 months agoHelaine
4 months agoJerry
4 months agoKayleigh
4 months agoRoy
5 months agoEden
5 months agoAlpha
5 months agoMohammad
5 months agoTerrilyn
5 months agoMarcos
6 months agoCarin
6 months agoTwana
6 months agoJamey
7 months agoVerda
7 months agoRolande
7 months agoLura
7 months agoSusy
8 months agoMalcom
8 months agoThaddeus
8 months agoMarva
11 months agoUlysses
1 year agoFarrah
1 year agoKiley
1 year agoCassi
1 year agoSkye
1 year agoKatlyn
1 year agoErick
1 year agoCarol
1 year agoMadelyn
1 year agoLaticia
1 year agoRory
1 year agoFrank
2 years agoPaul
2 years agoClorinda
2 years agoJackie
2 years agoLynelle
2 years agoAllene
2 years agoDominic
2 years agoKallie
2 years agoRonnie
2 years agoVal
2 years agoLeslie
2 years agoFelice
2 years agoIdella
2 years agoIsadora
2 years agoAngelica
2 years agoReena
2 years ago