Key details for this exam, checked against the published exam outline
Each question shows the correct answer and an explanation of why it is right
A Salesforce org has more than 50,000 contacts. A new business process requires a calculation that aggregates data from all of these contact records. This calculation needs to run once a day after business hours. Which two steps should a developer take to accomplish this?
This scenario presents two distinct requirements: processing a large volume of data (50,000 records) and running the process at a specific time (once a day after business hours).
Database.Batchable (Option B): Processing 50,000 records in a single synchronous transaction will exceed Apex Governor Limits (specifically the CPU time limit or the heap size limit). Batch Apex allows the system to process these records in smaller chunks (batches), ensuring that the calculation completes without hitting limits.
Schedulable (Option C): To ensure the job runs 'once a day after business hours,' the Schedulable interface is required. The developer allows the class to be scheduled via the Apex Scheduler or the UI.
The standard pattern for this use case is to create a class that implements Schedulable, and inside its execute method, instantiate and execute the Batch class (Database.executeBatch). This combines precise timing with bulk processing capabilities.
A developer needs to add code to a Lightning web component's configuration file so the component only renders for a desktop size form factor when on a record page. What should the developer add to the component's record page target configuration to meet this requirement?
In a Lightning Web Component's configuration file (.js-meta.xml), the <supportedFormFactors> tag allows the developer to specify which device form factors the component supports. To restrict the component to only render on desktop devices, the developer must specify the type='Large'.
The structure is:
XML
<targetConfigs>
<targetConfig targets='lightning__RecordPage'>
<supportedFormFactors>
<supportedFormFactor type='Large'/>
</supportedFormFactors>
</targetConfig>
</targetConfigs>
If supportedFormFactors is not specified, the component defaults to supporting both Small (phone) and Large (desktop) form factors. Options B, C, and D are incorrect syntax for defining form factor support in LWC metadata.
A developer is building a Lightning web component that retrieves data from Salesforce and assigns it to the record property:
JavaScript
import { LightningElement, api, wire } from 'lwc';
import { getRecord } from 'lightning/uiRecordApi';
export default class Record extends LightningElement {
@api fields;
@api recordId;
record;
}
What must be done in the component to get the data from Salesforce?
To retrieve record data in a Lightning Web Component using the Lightning Data Service (LDS), the developer must use the @wire decorator with the getRecord wire adapter.
Option D provides the correct syntax. The @wire decorator requires the adapter name (getRecord) and a configuration object. The configuration must include the recordId and either the fields or layoutTypes to be retrieved. By using the $ prefix (e.g., '$recordId'), the developer makes the property 'reactive.' This means that whenever the value of recordId or fields changes, the wire service automatically re-provisions the data from Salesforce.
Options A and C are incorrect because @api is used to expose public properties, not for wiring data. Option B is incorrect because getRecord requires a field list or layout type to know which data points to fetch from the server. Using the reactive $fields ensures that the component remains flexible and can load different field sets as defined by its parent component.
MyOpportunities.js
JavaScript
import { LightningElement, api, wire } from 'lwc';
import getOpportunities from '@salesforce/apex/OpportunityController.findMyOpportunities';
export default class MyOpportunities extends LightningElement {
@api userId;
@wire(getOpportunities, {oppOwner: '$userId'})
opportunities;
}
OpportunityController.cls
Java
public with sharing class OpportunityController {
@AuraEnabled
public static List
return [
SELECT Id, Name, StageName, Amount
FROM Opportunity
WHERE OwnerId = :oppOwner
];
}
}
A developer is experiencing issues with a Lightning web component. The co12mponent must surface information about Opportunities owned by the currently logged-in user. When the component is rendered, the following message is displayed: "Error retrieving data". Which action must be completed in the Apex method to make it wireable?13
To use the @wire service in a Lightning Web Component (LWC) to retrieve data from an Apex method, the Apex method must be marked as cacheable. In the provided OpportunityController class, the findMyOpportunities method is annotated with @AuraEnabled, but it lacks the mandatory cacheable=true property.
The @wire service is part of the Lightning Data Service (LDS) reactive framework. Salesforce requires wireable methods to be cacheable to improve performance and ensure that data can be stored in the client-side cache. Without (cacheable=true), the @wire decorator will fail to execute, resulting in the 'Error retrieving data' message or a similar runtime failure.
Option C is the correct fix: the developer must update the annotation to @AuraEnabled(cacheable=true). Option A (Continuation) is only for long-running external callouts. Option B (without sharing) might affect visibility but isn't a requirement for the wire service itself. Option D (OWD) affects whether records are visible based on security, but the technical failure described is rooted in the component-to-Apex binding requirement. Once marked as cacheable, the LDS can properly manage the data lifecycle for the component.
As part of a custom interface, a developer team creates various new Lightning web components. Each of the components handles errors using toast messages. 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?
When multiple components on a single page all fail simultaneously (for example, due to a shared service failure), individual toast messages stack up, creating a poor user experience. To resolve this, developers should shift away from 'ephemeral' notifications like toasts toward more structured error handling.
Option A involves creating a dedicated error-handling component. This component can act as a listener or a central repository for errors across the page. Instead of each component firing its own toast, they can communicate their error state to this central component, which aggregates the messages into a single, clean display. This reduces visual clutter and allows the user to read all errors in one place.
Option C refers to 'in-place' error handling. Using conditional rendering (the lwc:if or template if:true directives), a component can hide its normal UI and display an error message exactly where the component would have been. This provides immediate context to the user about which specific part of the page failed without interrupting the overall flow with pop-ups.
Option B (window.alert) is considered a legacy practice that blocks the browser thread and is generally avoided in modern web development. Option D (public properties) is a mechanism for component communication but doesn't solve the display problem itself. Combining A and C provides a modern, professional, and less intrusive error-handling strategy.
Given the following containment hierarchy:
HTML
What is the correct way to communicate the new value of a property named "passthrough" to my-parent-component if the property is defined within my-child-component?
In Lightning Web Components (LWC), data flows 'down' via properties and 'up' via events. When a child component needs to communicate a change in a property or state to its parent, it must dispatch a CustomEvent. To pass specific data---such as the new value of the passthrough property---along with the event, the developer must use the detail property within the event initialization object.
Option C is the correct syntax. It creates a new CustomEvent named 'passthrough' and assigns the current value of the component's property (this.passthrough) to the detail key. The parent component can then listen for this event (using onpassthrough={handleEvent}) and access the value via event.detail. Option A is incorrect because it wraps the variable in quotes, passing the literal string 'this.passthrough' instead of the actual data. Option B creates an event but fails to include the data payload, meaning the parent would know an event occurred but wouldn't receive the new value. Option D uses incorrect syntax for event naming and variable referencing. Using the standard CustomEvent constructor with the detail property is the platform-standard way to ensure robust, typed data communication between component layers in the Shadow DOM.
A developer sees test failures in the sandbox but not in production. No code or metadata changes have been actively made to either environment since the sandbox was created. Which consideration should be checked to resolve the issue?
When code behavior differs between two environments that theoretically share the same codebase, the root cause is often the underlying platform version. Salesforce releases updates (e.g., Spring, Summer, Winter) on a staggered schedule. Sandbox instances are frequently updated to the 'Preview' version of the upcoming release weeks before the Production environment.
If a sandbox is on a newer release (Option C), it may include changes to the Apex compiler, new platform governor limits, or modifications to how standard objects behave. If a test relies on a specific behavior that changed in the new release, it might fail in the sandbox while still passing in the older Production environment.
Option A (SeeAllData=true) is a poor practice and would likely cause more issues rather than resolve them. Option B is unlikely because API versions are fixed in the metadata of the class and wouldn't change spontaneously. Option D relates to execution speed and resource contention but rarely causes a functional test to pass in one environment and fail in another unless there are significant race conditions. Checking the release version is the standard first step when diagnosing environment-specific discrepancies in the absence of code changes.
Exam domains verified against: Official Salesforce Plat-Dev-301 exam guide, last checked October 2026.
Understand localization and multi-currency features and their coding implications. Learn when to use sharing objects and Apex managed sharing, and how to select appropriate custom metadata and custom settings implementations.
Master interactions between declarative and programmatic processes. Develop expertise in Apex triggers, error handling, advanced SOQL, asynchronous Apex, dynamic Apex features, platform events, and integration techniques for both inbound and outbound communication.
Analyze Apex controllers for Lightning web components and Aura components. Build responsive components across devices, handle error display, communicate between components, and use static resources effectively in Visualforce, LWC, and Aura.
Apply advanced testing techniques including mocks and stubs for Apex. Debug Lightning components, Visualforce, and JavaScript. Isolate root causes in non-executing code and formulate source-driven deployment processes using appropriate tools.
Identify UI performance issues and mitigation techniques. Optimize query structure for large data volumes. Recognize where asynchronous callouts improve performance and code reuse opportunities. Resolve inefficiencies in sample code.
Common questions about the exam itself