There is an Apex controller and a Visualforce page in an org that displays records with a custom filter consisting of a combination of picklist values selected by the
user.
The page takes too long to display results for some of the input combinations, while for other input choices it throws the exception, "Maximum view state size limit exceeded''.
What step should the developer take to resolve this issue?
Answer : C
To resolve the issue of the Visualforce page taking too long to display results or exceeding the view state limit, the developer should use a StandardSetController or implement SOQL LIMIT in the Apex controller. This limits the number of records that are processed and displayed at one time, which can prevent view state errors and improve performance. Reference: Visualforce Developer Guide - StandardSetController
Universal Containers uses a custom Lightning page to provide a mechanism to perform a step-by-step wizard search for Accounts. One of the steps in the wizard is to allow the user to input text into a text field, ERF Number_c, that is then used in a query to find matching Accounts.
Which step should be taken to resolve the issue?
Answer : D
If a SOQL query is causing performance issues due to a non-selective query on a large data volume, moving the query to an asynchronous process such as a Batch Apex or Queueable Apex can help resolve the issue. This allows the query to run in the background without affecting the user's experience.
The use of the transient keyword in Visualforce page controllers helps with which common performance issue?
Answer : C
The transient keyword in Visualforce page controllers marks variables that should not be part of the view state, which can significantly reduce the size of the view state. This can help avoid view state limit errors and improve page performance because a smaller view state requires less time to send to the client. Reference: Visualforce Developer Guide - Reducing View State Size
A developer is inserting, updating, and deleting multiple lists of records in a single transaction and wants to ensure that any error prevents all execution.
How should the developer implement error exception handling in their code to handle this?
Answer : C
Using Database.setSavepoint() and Database.rollback() within a try-catch statement is the recommended approach for handling transactions that involve multiple DML operations. This allows the developer to roll back all changes if an error occurs, ensuring that partial changes are not committed to the database. Reference: Apex Developer Guide - Savepoint and Transaction Control
A user receives the generic "An internal server error has occurred'' while interacting
with a custom Lightning component.
What should the developer do to ensure a more meaningful message?
Answer : D
Use AuraHandledException in try-catch for custom errors. It enables sending meaningful, user-friendly error messages to the Lightning component. Reference: Handling Errors in Lightning Components
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?
Answer : B
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. Reference: Apex Developer Guide - Asynchronous Callouts
A company uses Dpportunities to track sales to their customers and their org has millions of Opportunities. They want to begin to track revenue over time through a related Revenue object.
As part of their initial implementation, they want to perform a one-time seeding of their data by automatically creating and populating Revenue records for Opportunities, based on complex logic.
They estimate that roughly 100,000 Opportunities will have Revenue records created and populated.
What is the optimal way to automate this?
Answer : D
For a one-time bulk operation on a large data set, using a Database.Batchable class is the best approach. This allows complex logic to be processed in manageable chunks and efficiently manages system resources. Reference: Apex Developer Guide - Using Batch Apex