Pd2 - Sp24 PDF
Pd2 - Sp24 PDF
3 of 62. 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.
5 of 62. Which three Visualforce components can be used to initiate Ajax behavior to perform partial
page updates?
Choose 3 answers
A. apex:commandLink
B. apex:commandButton
C. apex:actionStatus
D. apex:actionSupport
E. apex:form
6 of 62. A developer is trying to access org data from within a test class.
Which sObject type requires the test class to have the (seeAllData=true) annotation?
A. Profile
B. User
C. Report
D. RecordType
7 of 62. A developer is asked to build a solution that will automatically send an email to the customer
when an Opportunity stage changes. The solution must scale to allow for 10,000 emails per day. The
criteria to send the email should be evaluated after certain conditions are met.
8 of 62. Universal Containers develops a Visualforce page that requires the inclusion of external
JavaScript and CSS files. They want to ensure efficient loading and caching of the page.
A. PageBlockTable
B. Static resources
C. ActionFunction
D. RemoteAction
9 of 62. A developer writes a Lightning web component that displays a dropdown list of all custom
objects in the org from which a user will select. An Apex method prepares and returns data to the
component.
What should the developer do to determine which objects to include in the response?
B. Check the getObjectType() value for 'Custom' or 'Standard' on the sObject describe result.
12 of 62. A developer is asked to modify a Lightning web component so that it displays in one column
on phones and in two columns on tablets, desktops, and larger devices.
<lightning-layout multiple-rows="true">
<lightning-layout-item>
<div>Example 1</div>
</lightning-layout-item>
<lightning-layout-item>
<div>Example 2</div>
</lightning-layout-item>
</lightning-layout>
Which should the developer add to the code to meet the requirements?
13 of 62. Which technique can run custom logic when a Lightning web component is loaded?
@isTest
private class searchFeature_Test{
@TestSetup
}
A developer receives complaints that the component loads slowly.
Which change can the developer implement to make the component perform faster?
16 of 62. A developer created an Apex class that updates an Account based on input from a Lightning
web component that is used to register an Account. The update to the Account should only be made if
! account.IsRegistered__c
if (!account.IsRegistered__c) {
account.IsRegistered__c = true;
// ...set other account fields...
update account;
}
What should the developer do to ensure that users do not overwrite each other's updates to the same
Account if they make updates at the same time?
Which edit should the developer make to ensure the test class runs successfully?
17 of 62. Universal Containers implements a private sharing model for the Convention_Attendee__c
custom object. As part of a new quality assurance effort, the company created an Event_Reviewer__c
user lookup field on the object. Management wants the event reviewer to automatically gain
Read/Write access to every record they are assigned to.
What is the best approach to ensure the assigned reviewer obtains Read/Write access to the record?
A. Create an after insert trigger on the Convention Attendee custom object, and use Apex Sharing
Reasons and Apex Managed Sharing.
B. Create a before insert trigger on the Convention Attendee custom object, and use Apex Sharing
Reasons and Apex Managed Sharing.
C. Create a criteria-based sharing rule on the Convention Attendee custom object to share the records
with a group of Event Reviewers.
D. Create a criteria-based sharing rule on the Convention Attendee custom object to share the records
with the Event Reviewers.
19 of 62. An org has a requirement that addresses on Contacts and Accounts should be normalized to a
company standard by Apex code any time that they are saved.
A. Apex trigger on Account that calls the Contact trigger to normalize the address
B. Apex trigger on Contact that calls the Account trigger to normalize the address
D. Apex triggers on Contact and Account that call a helper class to normalize the address
20 of 62. What is the best practice to initialize a Visualforce page in a test class?
A. Use controller.currentPage.setPage(MyTestPage);
B. Use Test.setCurrentPage(MyTestPage);
C. Use Test.currentPage.getParameters().put(MyTestPage);
D. Use Test.setCurrentPage(Page.MyTestPage);
21 of 62. As part of point-to-point integration, a developer must call an external web service which,
due to high demand, takes a long time to provide a response. As part of the request, the developer
must collect key inputs from the end user before making the callout.
Which two elements should the developer use to implement these business requirements?
Choose 2 answers
B. Batch Apex
C. Screen Flow
22 of 62. In an organization that has multi-currency enabled, a developer is tasked with building a
Lightning component that displays the top ten Opportunities most recently accessed by the logged-in
user. The developer must ensure the Amount and LastModifiedDate field values are displayed
according to the user's locale.
What is the most effective approach to ensure values displayed respect the user's locale settings?
<c-selected-order>
<c-order orderid={order.id}></c-order>
</template>
</c-selected-order>
How should the <c-order> component communicate to the <c-selected-order> component that an
order has been selected by the user?
28 of 62. A developer is working with existing functionality that tracks how many times a stage has
changed for an Opportunity. When the Opportunity's stage is changed, a workflow rule is fired to
increase the value of a field by one. The developer wrote an after trigger to create a child record when
the field changes from 4 to 5.
A user changes the stage of an Opportunity and manually sets the count field to 4. The count field
updates to 5, but the child record is not created.
B. Trigger.old does not contain the updated value of the count field.
The app will be surfaced to UC's existing iOS and Android users via the standard mobile app that
Salesforce provides. It has a custom user interface design and offline access is not required.
Given these requirements, what is the recommended approach to develop the app?
B. Salesforce SDK
D. Visualforce
31 of 62. A developer is debugging an Apex-based order creation process that has a requirement to
have three savepoints, SP1, SP2, and SP3 (created in order), before the final execution of the process.
During the final execution process, the developer has a routine to roll back to SP1 for a given
condition. Once the condition is fixed, the code then calls a roll back to SP3 to continue with final
execution. However, when the roll back to SP3 is called, a runtime error occurs.
C. The developer has too many DML statements between the savepoints.
32 of 62. A company has an Apex process that makes multiple extensive database operations and web
service callouts. The database processes and web services can take a long time to run and must be run
sequentially.
How should the developer write this Apex code without running into governor limits and system
limitations?
C. Use Limits class to stop entire process once governor limits are reached.
A. Define a method that creates test data and annotate with @NeverUseData.
B. Define a method that creates test data and annotate with @TestSetup.
34 of 62. A developer is asked to find a way to store secret data with an ability to specify which
profiles and users can access which secrets.
A. System.Cookie class
B. Custom settings
C. Static resources
D. Custom metadata
List<Account> accountList = [Select Id, Name, Industry FROM Account WHERE CreatedDate = :thisDate
OR RecordTypeId = :goldenRT];
return accountList;
The Apex method is executed in an environment with a large data volume count for Accounts, and the
query is performing poorly.
Which technique should the developer implement to ensure the query performs optimally, while
preserving the entire result set?
C. Create a formula field to combine the CreatedDate and RecordType value, then filter based on the
formula.
D. Break down the query into two individual queries and join the two result sets.
36 of 62. What is a benefit of JavaScript remoting over Visualforce Remote Objects?
Which best practice should the developer use to perform the validations on more than one field, thus
allowing more than one error message to be displayed simultaneously?
B. Client-side validation
D. Apex REST
38 of 62. A company accepts orders for customers in their enterprise resource planning (ERP) system
that must be integrated into Salesforce as Order__c records with a lookup field to Account. The
Account object has an external ID field, ERP_Customer_ID__c.
What should the integration use to create new Order__c records that will automatically be related to
the correct Account?
B. Upsert on the Order__c object and specify the ERP_Customer_ID__c for the Account relationship.
C. Upsert on the Account and specify the ERP_Customer_ID__c for the relationship.
D. Merge on the Order__c object and specify the ERP_Customer_ID__c for the Account relationship.
39 of 62. A developer is asked to look into an issue where a scheduled Apex is running into DML limits.
Upon investigation, the developer finds that the number of records processed by the scheduled Apex
has recently increased to more than 10,000.
40 of 62. 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?
D. Use a try-catch statement and handle DML cleanup in the catch statement.
41 of 62. A company uses an external system to manage its custom account territory assignments.
Every quarter, millions of Accounts may be updated in Salesforce with new Owners when the territory
assignments are completed in the external system.
What is the optimal way to update the Accounts from the external system?
A. SOAP API
D. Bulk API
42 of 62. The Account object has a field, Audit_Code__c, that is used to specify what type of auditing
the Account needs and a Lookup to User, Auditor__c, that is the assigned auditor.
When an Account is initially created, the user specifies the Audit_Code__c. Each User in the org has a
unique text field, Audit_Code__c, that is used to automatically assign the correct user to the Account's
Auditor__c field.
Choose 2 answers
43 of 62. An org records customer order information in a custom object, Order__c, that has fields for
the shipping address. A developer is tasked with adding code to calculate shipping charges on an
order, based on a flat percentage rate associated with the region of the shipping address.
What should the developer use to store the rates by region, so that when the changes are deployed to
production no additional steps are needed for the calculation to work?
A. Custom object
B. Developer Log
C. Calendar Events
45 of 62. Universal Containers wants to use a Customer Community with Customer Community Plus
licenses to allow their customers access to track how many containers they have rented and when
they are due back. Universal Containers uses a Private sharing model for External users.
Many of their customers are multi-national corporations with complex Account hierarchies. Each
account on the hierarchy represents a department within the same business.
One of the requirements is to allow certain community users within the same Account hierarchy to see
several departments' containers, based on a custom junction object that relates the Contact to the
various Account records that represent the departments.
A. A custom list view on the junction object with filters that will show the proper records based on
owner.
B. An Apex trigger that creates Apex managed sharing records based on the junction object's
relationships.
C. A Visualforce page that uses a custom controller that specifies without sharing to expose the records.
D. A Lightning web component on the Community Home Page that uses Lightning Data Services.
46 of 62. Which method should be used to convert a Date to a String in the current user's locale?
A. String.valueOf
B. Date.format
C. Date.parse
D. String.format
47 of 62. Which interface needs to be implemented by an Aura component so that it may be displayed
in modal dialog by clicking a button on a Lightning record page?
A. force:lightningEditAction
B. lightning:editAction
C. lightning:quickAction
D. force:lightningQuickAction
The Order__c object has private organization-wide defaults. The Order__c object has a custom field,
Quality_Controller__c, that is a Lookup to User and is used to indicate that the specified User is
performing quality control on the Order__c.
What should be used to automatically give read only access to the User set in the
Quality_Controller__c field?
B. Record ownership
C. Criteria-based sharing
49 of 62. A developer is asked to develop a new AppExchange application. A feature of the program
creates Survey records when a Case reaches a certain stage and is of a certain Record Type. This
feature needs to be configurable, as different Salesforce instances require Surveys at different times.
Additionally, the out-of-the-box AppExchange app needs to come with a set of best practice settings
that apply to most customers.
What should the developer use to store and package the custom configuration settings for the app?
A. Custom labels
B. Custom metadata
C. Custom objects
D. Custom settings
50 of 62. Refer to the test method below:
Line 1: @isTest
Line 2: static void testMyTrigger() {
Line 3: {
Line 4: //Do a bunch of data setup
Line 5: DataFactory.setupDataForMyTriggerTest();
Line 6:
Line 7: List<Account> acctsBefore = [SELECT IsCustomer__c FROM Account WHERE Id IN
:DataFactory.accounts];
Line 8:
Line 9: //Utility to assert all accounts are not customers before the update
Line 10: AssertUtil.assertNotCustomers(acctsBefore);
Line 11:
The test method fails at the Line 20 because of too many SOQL queries.
A. Add Test.startTest() before and add Test.stopTest() after both Line 7 and Line 20 of the code.
B. Change the DataFactory class to create fewer Accounts so that the number of queries in the trigger is
reduced.
C. Use Limits.getLimitQueries() to find the total number of queries that can be issued.
D. Add Test.startTest() before and add Test.stopTest() after Line 18 of the code.
51 of 62. Which two queries are selective SOQL queries and can be used for a large data set of 200,000
Account records?
Choose 2 answers
B. SELECT Id FROM Account WHERE Name IN (List of Names) AND Customer_Number__c = 'ValueA'
Which tool or mechanism should be utilized for managing the source-driven deployment process?
B. Data Loader
C. Change Sets
D. Change Sets
53 of 62. 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.
Choose 2 answers
54 of 62. A business currently has a process to manually upload orders from its external Order
Management System (OMS) into Salesforce.
This is a labor-intensive process since accounts must be exported out of Salesforce to get the IDs. The
upload file must be updated with the correct account IDs to relate the orders to the corresponding
accounts.
Choose 2 answers
A. Identify unique fields on Order and Account and set them as External IDs.
B. Use the upsert wizard in the Data Loader to import the data.
D. Use the insert wizard in the Data Loader to import the data.
55 of 62. Which use case can be performed only by using asynchronous Apex?
56 of 62. A Salesforce Platform Developer is leading a team that is tasked with deploying a new
application to production. The team has used source-driven development, and they want to ensure
that the application is deployed successfully.
What tool or mechanism should be used to verify that the deployment is successful?
A. Salesforce Inspector
D. Salesforce DX CLI
@isTest
static void testAccountUpdate() {
Account acct = new Account(Name = 'Test1');
acct.Integration_Updated__c = false;
insert acct;
CalloutUtil.sendAccountUpdate(acct.Id);
Account acctAfter = [SELECT Id, Integration_Updated__c FROM Account WHERE Id = :acct.Id][0];
System.assert(true, acctAfter.Integration_Updated__c);
}
The test fails to execute and exits with an error: "Methods defined as TestMethod do not support Web
service callouts."
A. Ensure the records are inserted before the Test.startTest() statement and the mock callout occurs after
the Test.startTest().
B. Ensure both the insertion and mock callout occur after the Test.startTest().
C. Ensure both the insertion and mock callout occur within a method annotated with @TestSetup.
D. Ensure both the insertion and mock callout occur after the Test.stopTest().
59 of 62. A developer created an Opportunity trigger that updates the account rating when an
associated opportunity is considered high value. Current criteria for an opportunity to be considered
high value is an amount greater than or equal to $1,000,000. However, this criteria value can change
over time.
There is a new requirement to also display high value opportunities in a Lightning web component.
Which two actions should the developer take to meet these business requirements, and also prevent
the business logic that obtains the high value opportunities from being repeated in more than one
place? Choose 2 answers
B. Leave the business logic code inside the trigger for efficiency.
60 of 62. How should a developer verify that a specific Account record is being tested in a test class for
a Visualforce controller?
A. Insert the Account into Salesforce, instantiate the page reference in the test class, then use
System.setParentRecordId().get() to set the Account ID.
B. Insert the Account in the test class, instantiate the page reference in the test class, then use
system.currentPageReference().getParameters().put() to set the Account ID.
C. Instantiate the page reference in the test class, insert the Account in the test class, then use
system.setParentRecordId().get() to set the Account ID.
D. Instantiate the page reference in the test class, insert the Account in the test class, then use
seeAllData=true to view the Account.
Platform Developer 2 – SP24 SET 2
1 of 62. Universal Charities (UC) uses Salesforce to collect electronic donations in the form of credit
card deductions from individuals and corporations.
When a customer service agent enters the credit card information, it must be sent to a 3rd-party
payment processor for the donation to be processed. UC uses one payment processor for individuals
and a different one for corporations.
What should a developer use to store the payment processor settings for the different payment
processors, so that their system administrator can modify the settings once they are deployed, if
needed?
A. Custom metadata
D. Custom label
2 of 62. The use of the transient keyword in Visualforce page controllers helps with which common
performance issue?
What should the developer add to the component's record page target configuration to meet this
requirement?
A. <design>
</design>
B. <supportedFormFactors>
<supportedFormFactor type="Large"/>
</supportedFormFactors>
C. <lightning:layout formFactor="Large">
</lightning:layout>
</property>
4 of 62. A company has a Lightning page with many Lightning Components, some that cache reference
data. It is reported that the page does not always show the most current reference data.
What can a developer use to analyze and diagnose the problem in the Lightning page?
What should the developer do to ensure that a partial refresh is made so that only the section
identified with opportunityList is re-drawn on the screen?
6 of 62. An org has a requirement that an Account must always have one and only one Contact listed
as Primary. So selecting one Contact will de-select any others. The client wants a checkbox on the
Contact called 'Is Primary' to control this feature. The client also wants to ensure that the last name of
every Contact is stored entirely in uppercase characters.
A. Write a single trigger on Contact for both after update and before update and callout to helper classes
to handle each set of logic.
B. Write an after update trigger on Account for the Is Primary logic and a before update trigger on
Contact for the last name logic.
C. Write an after update trigger on Contact for the Is Primary logic and a separate before update trigger
on Contact for the last name logic.
D. Write a Validation Rule on the Contact for the Is Primary logic and a before update trigger on Contact
for the last name logic.
7 of 62. Universal Containers (UC) has enabled the translation workbench and has translated picklist
values. UC has a custom multi-select picklist field, Products__c, on the Account object that allows sales
reps to specify which of UC's products an Account already has. A developer is tasked with writing an
Apex method that retrieves Account records, including the Products__c field.
What should the developer do to ensure the value of Products__c is in the current user's language?
C. Call the translate() method on each record in the SOQL result list.
8 of 62. Universal Containers wants to notify an external system, in the event that an unhandled
exception occurs, by publishing a custom event using Apex.
A. Publish the error event using the addError() method and write a trigger to subscribe to the event and
notify the external system.
B. Publish the error event using the addError() method and have the external system subscribe to the
event using CometD.
C. Have the external system subscribe to the event channel. No publishing is necessary.
D. Publish the error event using the Eventbus.publish() method and have the external system subscribe
to the event using CometD.
10 of 62. Given the following containment hierarchy:
<template>
<c-my-child-component></c-my-child-component>
</template>
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?
this.dispatchEvent(cEvent);
this.dispatchEvents(cEvent);
this.dispatchEvent(cEvent);
this.dispatchEvent(cEvent);
11 of 62. Which statement is considered a best practice for writing bulk safe Apex triggers?
A. Add records to collections and perform DML operations against these collections.
C. Use the Database methods with allOrNone set to false instead of DML statements.
Which statement properly loads the static resource within the LWC?
D. <lightning:require src="{!$Resource.jsUtil}"/>
A. Does the screen need to be accessible from the Lightning Experience UI?
D. Does the screen need to be rendered as a PDF without using a third-party application?
17 of 62. A developer needs to implement a system audit feature that allows users, assigned to a
custom profile named "Auditors", to perform searches against the historical records in the Account
object. The developer must ensure the search is able to return history records that are between 6 and
12 months old.
Given the code below, which select statement should be inserted below as a valid way to retrieve the
Account History records ranging from 6 to 12 months old?
FROM AccountHistory
FROM AccountHistory
FROM AccountHistory
FROM AccountHistory
What should be used to give the User on the Reviewer__c record read-only access to the Defect__c
record on the Reviewer__c record?
B. Criteria-based sharing
21 of 62. Salesforce users consistently receive a "Maximum trigger depth exceeded" error when saving
an Account.
23 of 62. There are user complaints about slow render times of a custom data table within a
Visualforce page that loads thousands of Account records at once.
What can a developer do to help alleviate such issues?
25 of 62. A business requires that every parent record must have a child record. A developer writes an
Apex method with two DML statements to insert a parent record and a child record.
A validation rule blocks child records from being created. The method uses a try/catch block to handle
the DML exception.
What should the developer do to ensure the parent always has a child record?
A. Delete the parent record in the catch statement when an error occurs on the child record DML
operation.
B. Use addError() on the parent record if an error occurs on the child record.
C. Set a database savepoint to rollback if there are errors.
D. Use Database.insert() and set the allOrNone parameter to true.
26 of 62. A developer is writing a Lightning Web component that queries accounts in the system and
presents a lightning-datatable with the results. The users want to be able to filter the results based on
up to five fields, that will vary according to their selections when running the page.
A. REST API
B. Dynamic SQL
C. describeSObjects()
D. SOSL queries
27 of 62. How should a developer assert that a trigger with an asynchronous process has successfully
run?
A. Create all test data in the test class, use System.runAs() to invoke the trigger, then perform assertions.
B. Create all test data in the test class, invoke Test.startTest() and Test.stopTest() and then perform
assertions.
C. Insert records into Salesforce, use seeAllData=true, then perform assertions.
D. Create all test data, use @future in the test class, then perform assertions.
MyOpportunities.js
Which modification should be implemented to the Apex class to overcome the issue?
A. Edit the code to use the without sharing keyword in the Apex class.
B. Use the Continuation attribute in the Apex method.
C. Use the Cacheable attribute in the Apex method.
D. Ensure the OWD for the Opportunity object is Public.
29 of 62. A developer is writing a Visualforce page that queries accounts in the system and presents a
data table with the results. The users want to be able to filter the results based on up to five fields.
However, the users want to pick the five fields to use as filter fields when they run the page.
A. Streaming API
B. Metadata API
C. Variable binding
D. Dynamic SOQL
30 of 62. A large company uses Salesforce across several departments. Each department has its own
Salesforce Administrator. It was agreed that each Administrator would have their own sandbox in
which to test changes.
Recently, users notice that fields that were recently added for one department suddenly disappear
without warning.
Which two statements are true regarding these issues and resolution? Choose 2 answers
A. Page Layouts should never be deployed via Change Sets, as this causes Field-Level Security to be reset
and fields to disappear.
B. The administrators are deploying their own Change Sets over each other, thus replacing entire Page
Layouts in production.
C. The administrators are deploying their own Change Sets, thus deleting each other's fields from the
objects in production.
D. A sandbox should be created to use as a unified testing environment instead of deploying Change Sets
directly to production.
@isTest
static void testUpdateSuccess() {
Account acct = new Account(Name = 'Test');
insert acct;
extension.inputValue = 'test';
PageReference pageRef = extension.update();
System.assertNotEquals(null, PageRef);
}
What should be added to the setup, in the location indicated, for the unit test above to create the
controller extension for the test?
33 of 62. What are three reasons that a developer should write Jest tests for Lightning web
components? Choose 3 answers
35 of 62. A company has a native iOS order placement app that needs to connect to Salesforce to
retrieve consolidated information from many different objects in a JSON format.
A. Use a list custom setting to disable the trigger for the user who loads the data.
B. Add the Profile ID of the user who loads the data to the trigger, so the trigger will not fire for this user.
C. Use a hierarchy custom setting to skip executing the logic inside the trigger for the user who loads the
data.
D. Add a validation rule to the Contract to prevent Contract creation by the user who loads the data.
38 of 62. A developer is tasked with creating a Lightning web component that is responsive on various
devices.
Which two components should help accomplish this goal? Choose 2 answers
A. lightning-layout-item
B. lightning-layout
C. lightning-input-location
D. lightning-navigation
39 of 62. A developer created a Lightning web component for the Account record page that displays
the five most recently contacted Contacts for an Account. The Apex method, getRecentContacts,
returns a list of Contacts and will be wired to a property in the component.
01:
02: public class ContactFetcher {
03:
04: static List<Contact> getRecentContacts(Id accountId) {
05: List<Contact> contacts = getFiveMostRecent(accountId);
06: return contacts;
07: }
08:
09: private static List<Contact> getFiveMostRecent(Id accountId) {
10: //...implementation...
11: }
12: }
Which two lines must change in the above code to make the Apex method able to be wired? Choose 2
answers
A. Add @AuraEnabled(cacheable=true) to line 03.
B. Add public to line 04.
C. Remove private from line 09.
D. Add @AuraEnabled(cacheable=true) to line 08.
40 of 62. Universal Containers is leading a development team that follows the source-driven
development approach in Salesforce. As part of their continuous integration and delivery (CI/CD)
process, they need to automatically deploy changes to multiple environments, including sandbox and
production.
Which mechanism or tool would best support their CI/CD pipeline in source-driven development?
A. Change Sets
B. Ant Migration Tool
C. Salesforce CLI with Salesforce DX
D. Salesforce Extensions for Visual Studio Code
42 of 62. A developer wrote a class named AccountHistoryManager that relies on field history tracking.
The class has a static method called getAccountHistory that takes in an Account as a parameter and
returns a list of associated AccountHistory object records.
The following test fails:
@isTest
public static void testAccountHistory() {
Account a = new Account(name = 'test');
insert a;
a.name = a.name + '!';
update a;
List<AccountHistory> ahList = AccountHistoryManager.getAccountHistory(a);
System.assert(ahList.size() > 0);
}
What should be done to make this test pass?
A. The test method should be deleted since this code cannot be tested.
B. Use @isTest(SeeAllData=true) to see historical data from the org and query for AccountHistory
records.
C. Create AccountHistory records manually in the test setup and write a query to get them.
D. Use Test.isRunningTest() in getAccountHistory() to conditionally return fake AccountHistory records.
43 of 62. An environment has two Apex triggers: an after-update trigger on Account and an after-
update trigger on Contact.
The Account after-update trigger fires whenever an Account's address is updated, and it updates every
associated Contact with that address. The Contact after-update trigger fires on every edit, and it
updates every Campaign Member record related to the Contact with the Contact's state.
Consider the following: A mass update of 200 Account records' addresses, where each Account has 50
Contacts. Each Contact has one Campaign Member. This means there are 10,000 Contact records
across the Accounts and 10,000 Campaign Member records across the contacts.
A. There will be no error, since each trigger fires within its own context and each trigger does not exceed
the limit of the number of records processed by DML statements.
B. The mass update of Account addresses will succeed, but the Contact address updates will fail due to
exceeding the number of records processed by DML statements.
C. The mass update will fail, since the triggers fire in the same context, thus exceeding the number of
records processed by DML statements.
D. There will be no error and all updates will succeed, since the limit on the number of records processed
by DML statements was not exceeded.
44 of 62. A developer wrote the following method to find all the test accounts in the org:
@isTest
public static void testSearchTestAccounts() {
Account a = new Account(name='test');
insert a;
Account[] accounts = TestAccountFinder.searchTestAccounts();
System.assert(accounts.size() == 1);
}
What should be used to fix this failing test?
A. lightning-record-edit-form
B. lightning-input-field
C. lightning-input
D. lightning-record-form
List<Account> testAccounts = [SELECT Id, Name from Account WHERE Name like 'Test%'];
System.assert(testAccounts.size() > 0);
delete testAccounts;
testAccounts = [SELECT Id, Name from Account WHERE Name like 'Test%'];
System.assert(testAccounts.size() == 0);
}
The developer org has five accounts where the name starts with "Test". The developer executes this
test in the Developer Console.
After the test code runs, which statement is true?
48 of 62. A Lightning web component exists in the system and displays information about the record in
context as a modal. Salesforce administrators need to use this component within the Lightning App
Builder.
Which two settings should the developer configure within the xml resource file? Choose 2 answers
What should be used to automatically give Read access to the record when the lookup field is set to
the Interviewer user?
<template>
<!-- ... other code ... -->
<lightning-record-form
record-id={recordId}
object-api-name="Account"
layout-type="Full">
</lightning-record-form>
</template>
A Lightning web component displays the Account name and two custom fields out of 275 that exist on
the object. The custom fields are correctly declared and populated. However, the developer receives
complaints that the component performs slowly.
52 of 62. Universal Containers needs to integrate with their own, existing, internal custom web
application. The web application accepts JSON payloads, resizes product images, and sends the resized
images back to Salesforce.
Both custom objects have a CurrencyIsoCode text field that contains the currency code they should
use. If a Catalog's CurrencyIsoCode changes, all of its Catalog Items' CurrencyIsoCodes should be
changed as well.
What should a developer use to update the CurrencyIsoCodes on the Catalog Items when the Catalog's
CurrencyIsoCode changes?
A. An after insert trigger on Catalog Item that updates the Catalog Items if the Catalog's CurrencyIsoCode
is different
B. A Database.Schedulable and Database.Batchable class that queries the Catalog Item object and
updates the Catalog Items if the Catalog's CurrencyIsoCode is different
C. A Database.Schedulable and Database.Batchable class that queries the Catalog object and updates the
Catalog Items if the Catalog's CurrencyIsoCode is different
D. An after insert trigger on Catalog that updates the Catalog Items if the Catalog's CurrencyIsoCode is
different
54 of 62. A developer is writing code that requires making callouts to an external web service.
55 of 62. When developing a Lightning web component, which setting displays lightning-layout-items
in one column on small devices, such as mobile phones, and in two columns on tablet-size and
desktop-size screens?
57 of 62. A company needs to automatically delete sensitive information after seven years. This could
delete almost a million records every day.
How can this be achieved?
A. Schedule an @future process to query records older than seven years, and then recursively invoke
itself in 1,000 record batches to delete them.
B. Schedule a batch Apex process to run every day that queries and deletes records older than seven
years.
C. Perform a SOSL statement to find records older than 7 years, and then delete the entire result set.
D. Use aggregate functions to query for records older than seven years, and then delete the
AggregateResult objects.
58 of 62. Given a list of Opportunity records named opportunityList, which code snippet is best for
querying all Contacts of the Opportunity's Account?
A.
List<Contact> contactList = new List<Contact>();
Set<Id> accountIds = new Set<Id>();
for(Opportunity o : opportunityList) {
accountIds.add(o.AccountId);
}
for(Account a : [SELECT Id, (SELECT Id FROM Contacts) FROM Account WHERE Id IN :accountIds]) {
contactList.addAll(a.Contacts);
}
B.
List<Contact> contactList = new List<Contact>();
Set<Id> contactIds = new Set<Id>();
for(Opportunity o : opportunityList) {
contactIds.add(o.ContactId);
}
for(Contact c : [SELECT Id FROM Contact WHERE Id IN :contactIds]) {
contactList.add(c);
}
C.
List<Contact> contactList = new List<Contact>();
for(Contact c : [SELECT Id FROM Contact WHERE AccountId IN (SELECT AccountId FROM Opportunity
WHERE Id IN :opportunityList)]) {
contactList.add(c);
}
61 of 62. A developer is tasked with ensuring that email addresses entered into the system for
Contacts and for a custom object called Survey_Response__c do not belong to a list of blocked
domains.
The list of blocked domains is stored in a custom object for ease of maintenance by users. The
Survey_Response__c object is populated via a custom Visualforce page.
A. Implement the logic in an Apex trigger on Contact and also implement the logic within the custom
Visualforce page controller.
B. Implement the logic in the custom Visualforce page controller and call that method from an Apex
trigger on Contact.
C. Implement the logic in validation rules on the Contact and the Survey_Response__c objects.
D. Implement the logic in a helper class that is called by an Apex trigger on Contact and from the custom
Visualforce page controller.
Platform Developer 2 – SP24 SET 3
7 of 62. Given the following code:
for (Contact c : [SELECT Id, LastName FROM Contact WHERE CreatedDate = TODAY]) {
Account a = [SELECT Id, Name FROM Account WHERE CreatedDate = TODAY LIMIT 5];
c.AccountId = a.Id;
update c;
}
Assuming there were 10 Contacts and five Accounts created today, what is the expected result?
15 of 62. A developer creates an application event that has triggered an infinite loop.
23 of 62. A company has reference data stored in multiple custom metadata records that represent
default information and delete behavior for certain geographic regions.
When a contact is inserted, the default information should be set on the contact from the custom
metadata records based on the contact's address information. Additionally, if a user attempts to
delete a contact that belongs to a flagged region, the user must get an error message.
Depending on company personnel resources, what are two ways to automate this? Choose 2 answers
43 of 62. A company uses Salesforce to sell products to customers. They also have an external product
information management (PIM) system that is the system of record for products.
A. Invocable Action
B. Custom Apex REST
C. SObject Tree REST
D. Event Monitoring
@isTest
static void testIncrement() {
Account acct = new Account(Name = 'Test');
acct.Number_Of_Times_Viewed__c = 0;
insert acct;
AuditUtil.incrementViewed(acct.Id);
Account acctAfter = [SELECT Number_Of_Times_Viewed__c FROM Account WHERE Id = :acct.Id][0];
System.assertEquals(1, acctAfter.Number_Of_Times_Viewed__c);
}
The test method calls an @future method that increments the Number_Of_Times_Viewed__c value.
The assertion is failing because the Number_Of_Times_Viewed__c equals 0.
A. Return all records into a list when the component is created and filter the array in JavaScript.
B. Use a selective SOQL query with a custom index.
C. Use SOSL to query the records on filter change.
D. Use setStorable() in the Apex method to store the response in the client-side cache.
56 of 62. Business rules require a Contact to always be created when a new Account is created.
What can be used when developing a custom screen to ensure an Account is not created if the
creation of the Contact fails?
1 of 62. A company uses Opportunities 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.
4 of 62. A developer created a class that implements the Queueable Interface, as follows:
Which two actions should the developer take to successfully execute the test class?
Choose 2 answers
When using Aura components, which approach should the developer implement to ensure the
Lightning application complies with the user's locale?
In the preceding Apex code, how can the developer alter the query statement to use SOQL features to
prevent race conditions within a transaction?
A. [Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId LIMIT
50 FOR UPDATE]
B. [Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId LIMIT 50
FOR VIEW]
C. [Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId USING
SCOPE LIMIT 50]
D. [Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId LIMIT
50 FOR REFERENCE]
10 of 62. A developer is building a complex commission calculation engine in Apex that is called from
an Opportunity trigger. During QA it was reported that the calculations are incorrect.
The developer has representative test data and passing test methods in their developer sandbox.
Which three tools or techniques could the developer use to execute the code and pause it at key lines
to visually inspect values of various Apex variables?
Choose 3 answers
A. Apex Interactive Debugger
B. Workbench
C. Developer Console
D. Breakpoints
E. Apex Replay Debugger
11 of 62. A developer built an Aura component for guests to self-register upon arrival at a front desk
kiosk. Now the developer needs to create a component for the utility tray to alert users whenever a
guest arrives at the front desk.
12 of 62. Which code snippet processes records in the most memory efficient manner, avoiding
governor limits such as "Apex heap size too large"?
13 of 62. Universal Containers is using a custom Salesforce application to manage customer support
cases. The support team needs to collaborate with external partners to resolve certain cases. However,
they want to control the visibility and access to the cases shared with the external partners.
A developer recently deployed an Opportunity before update trigger that uses the
CommissionBaseAmount__c and complex logic to calculate a value for a custom field,
CommissionAmount__c, when an Opportunity stage changes to Closed/Won.
Users report that when they change the Opportunity to Closed/Won and also change the Amount
during the same save, the CommissionAmount__c is incorrect.
17 of 62. A developer is creating a Lightning web component to display a calendar. The component will
be used in multiple countries. In some locales, the first day of the week is a Monday, or a Saturday, or
a Sunday.
What should the developer do to ensure the calendar displays accurately for users in every locale?
A. Use UserInfo.getLocale() in the component.
B. Query the firstDayOfWeek field from the Locale for the current user.
C. Use a custom metadata type to store key/value pairs.
D. Import the @salesforce/i18n module and use the firstDayOfWeek internationalization property.
19 of 62. A company notices that their unit tests in a test class with many methods to create many
records for prerequisite reference data are slow.
20 of 62. A company wants to incorporate a third-party web service to set the Address fields when an
Account is inserted, if they have not already been set.
Given the code above, which two changes need to be made in the Apex Controller for the code to
work?
Choose 2 answers
A. Annotate the entire class as @AuraEnabled instead of just the single method.
B. Change the argument in the Apex Controller line 05 from sObject to String.
C. Change the method signature to be global static, not public static.
D. Remove line 06 from the Apex Controller and instead use firstName in the return on line 07.
25 of 62. A developer is writing a Jest test for a Lightning web component that conditionally displays
child components based on a user’s checkbox selections.
What should the developer do to properly test that the correct components display and hide for each
scenario?
A. Create a new describe block for each test.
B. Create a new jsdom instance for each test.
C. Add a teardown block to reset the DOM after each test.
D. Reset the DOM after each test with the afterEach() method.
27 of 62. A developer is building a Lightning web component that retrieves data from Salesforce and
assigns it to the record property.
record;
}
What must be done in the component to get the data from Salesforce?
A. An after update trigger on Case that creates the Engineering Review record and inserts it
B. An after upsert trigger on Case that creates the Engineering Review record and inserts it
C. A before update trigger on Case that creates the Engineering Review record and inserts it
D. A before upsert trigger on Case that creates the Engineering Review record and inserts it
33 of 62. A company recently deployed a Visualforce page with a custom controller that has a data grid
of information about Opportunities in the org. Users report that they receive a "Maximum view state
size limit" error message under certain conditions.
According to Visualforce best practice, which three actions should the developer take to reduce the
view state?
Choose 3 answers
34 of 62. An Apex trigger creates an Order__c record every time an Opportunity is won by a Sales Rep.
Recently the trigger is creating two orders.
A. Disable all flows, and then re-enable them one at a time to see which one causes the error.
B. Run the Apex Test Classes for the Apex trigger to ensure the code still has sufficient code coverage.
C. Add system.debug() statements to the code and use the Developer Console logs to trace the code.
D. Set up debug logging for every Sales Rep, then monitor the logs for errors and exceptions.
35 of 62. Consider the following code snippet:
As part of the deployment cycle, a developer creates the following test class:
Which change should the developer implement in the Apex test method to ensure the test method
executes successfully?
A. Query the Administrator user into memory and enclose lines 15 and 16 within the system.runAs(user)
method.
B. Add System.runAs(User) to line 14 and enclose line 15 within Test.startTest() and Test.stopTest().
C. Add @IsTest(seeAllData=true) to line 12 and enclose lines 15 and 16 within Test.startTest() and
Test.stopTest().
D. Query the Standard User into memory and enclose lines 15 and 16 within the system.runAs(user)
method.
38 of 62. A developer created a Lightning web component that allows users to input a text value that is
used to search for Accounts by calling an Apex method. The Apex method returns a list of
AccountWrappers and is called imperatively from a JavaScript event handler.
41 of 62. A developer is developing a reusable Aura component that will reside on an sObject
Lightning page with the following HTML snippet:
<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes">
<div>Hello!</div>
</aura:component>
How can the component's controller get the context of the Lightning page that the sObject is on
without requiring additional test coverage?
A. Use JavaScript to move data processing to the browser instead of the controller.
B. Use the transient keyword for the List variables used in the custom controller.
C. Use an apex:actionPoller in the page to load all of the data asynchronously.
D. Use lazy loading to load the data on demand, instead of in the controller's constructor.
44 of 62. Universal Containers has an Apex trigger on Account that creates an Account Plan record
when an Account is marked as a Customer.
Recently a record-triggered flow was added so that whenever an Account is marked as a Customer, a
'Customer Since' date field is updated with today's date. Since the addition of the flow, two Account
Plan records are created whenever the Account is marked as a Customer.
A. The flow is configured to evaluate when a record is created and every time it is edited.
B. The Apex trigger is not bulk safe and calls insert inside of a for loop.
C. The flow is configured to use an 'Update Records' element.
D. The Apex trigger does not use a static variable to ensure it only fires once.
45 of 62. Part of a custom Lightning component displays the total number of Opportunities in the org,
which are in the millions. The Lightning component uses an Apex method to get the data it needs.
What is the optimal way for a developer to get the total number of Opportunities for the Lightning
component?
For these queries, assume that there are more than 200,000 Account records.
These records include soft-deleted records; that is, deleted records that are still in the Recycle Bin.
There are two fields that are marked as External Id on the Account. These fields are
Customer_Number__c and ERP_Key__c.
Which two queries are optimized for large data volumes?
Choose 2 answers
49 of 62. A developer creates a Lightning web component to allow a Contact to be quickly entered.
However, error messages are not displayed.
<template>
<lightning-record-edit-form object-api-name="Contact">
<lightning-input-field field-name="FirstName"></lightning-input-field>
<lightning-input-field field-name="LastName"></lightning-input-field>
<lightning-input-field field-name="Email"></lightning-input-field>
<lightning-button type="submit" name="submit" label="Create Contact"></lightning-button>
</lightning-record-edit-form>
</template>
Which component should the developer add to the form to display error messages?
A. apex:messages
B. lightning-messages
C. lightning-error
D. aura:messages
51 of 62. A developer has a Visualforce page that automatically assigns ownership of an Account to a
queue upon save. The page appears to correctly assign ownership, but an assertion validating the
correct ownership fails.
A. The test class does not retrieve the updated value from the database.
B. The test class does not implement the queueable interface.
C. The test class does not use the Bulk API for loading test data.
D. The test class does not use the seeAllData=true annotation.
52 of 62. Refer to the following code snippet:
A developer created a JavaScript function as part of a Lightning web component (LWC) that surfaces
information about Leads by wire calling getFetchLeadList when certain criteria are met.
Which three changes should the developer implement in the Apex class above to ensure the LWC can
display data efficiently while preserving security?
Choose 3 answers
@RemoteAction
global static Account getAccount(String accountName) {
account = [SELECT Id, Name, NumberOfEmployees
FROM Account WHERE Name = :accountName];
return account;
}
}
Which code snippet will assert that the remote action returned the correct Account?
A. Account a = MyRemoter.getAccount('TestAccount');
System.assertEquals('TestAccount', a.Name);
D. Account a = controller.getAccount('TestAccount');
System.assertEquals('TestAccount', a.Name);
54 of 62. Which tag should a developer use to display different text while an <apex:commandButton>
is processing an action?
A. <apex:actionPoller>
B. <apex:pageMessages>
C. <apex:actionSupport>
D. <apex:actionStatus>
57 of 62. Consider the following code snippet:
Choose 2 answers
58 of 62. A developer wrote an Apex class to make several callouts to an external system.
If the URLs used in these callouts will change often, which feature should the developer use to
minimize changes needed to the Apex class?
A. Session Id
B. Connected Apps
C. Named Credentials
D. Remote Site Settings
59 of 62. A developer wants to write a generic Apex method that will compare the Salesforce Name
field between any two object records. For example, to compare the Name field of an Account and an
Opportunity; or the Name of an Account and a Contact.
Assuming the Name field exists, how should the developer do this?
A. Use a String.replace() method to parse the contents of each Name field and then compare the results.
B. Cast each object into an sObject and use sObject.get('Name') to compare the Name fields.
C. Invoke a Schema.describe() function to compare the values of each Name field.
D. Use the Salesforce Metadata API to extract the value of each object and compare the Name fields.
60 of 62. A developer needs to store variables to control the style and behavior of a Lightning Web
Component.
Which feature can be used to ensure that the variables are testable in both Production and all
Sandboxes?
A. Custom metadata
B. Custom object
C. Custom variable
D. Custom setting
Platform Developer 2 – SP24 SET 4
4 of 65. What should a developer use to query all Account fields for the Acme account in their
sandbox?
8 of 65. A company has code to update a Request and Request Lines and make a callout to their
external ERP system's REST endpoint with the updated records.
<apex:selectList value="{!selectedIndustry}">
<apex:selectOptions value="{!industries}"/>
</apex:selectList>
When a user changes the value in the industry select list, the table of Accounts should be
automatically updated to show the Accounts associated with the selected industry.
27 of 65. A Visualforce page needs to make a callout to get billing information and tax information
from two different REST endpoints. The information needs to be displayed to the user at the same
time and the return value of the billing information contains the input for the tax information callout.
Each endpoint might take up to two minutes to process.
A. An HTTP REST callout for both the billing callout and the tax callout.
B. An HTTP REST callout for the billing callout and a Continuation for the tax callout.
C. A Continuation for both the billing callout and the tax callout.
D. A Continuation for the billing callout and an HTTP REST callout for the tax callout.
28 of 65. A developer wrote a trigger on Opportunity that will update a custom Last Sold Date field on
the Opportunity's Account whenever an Opportunity is closed. In the test class for the trigger, the
assertion to validate the Last Sold Date field fails.
A. The test class has not defined an Account owner when inserting the test data.
B. The test class has not re-queried the Account record after updating the Opportunity.
C. The test class has not implemented seeAllData=true in the test method.
D. The test class is not using system.runAs() to run tests as a Salesforce administrator.
30 of 65. Universal Containers stores user preferences in a hierarchy custom setting, User_Prefs__c,
with a checkbox field, Show_Help__c. Company-level defaults are stored at the organizational level,
but may be overridden at the user level. If a user has not overridden preferences, then the defaults
should be used.
How should the Show_Help__c preference be retrieved for the current user?
31 of 65. An Apex trigger and Apex class increment a counter, Edit_Count__c, any time the Case is
changed.
A.
public class CaseTriggerHandler {
Boolean firstRun = true;
public static void handle(List<Case> cases) {
if (firstRun) {
for (Case c : cases) {
c.Edit_Count__c = c.Edit_Count__c + 1;
}
}
firstRun = false;
}
}
B.
public class CaseTriggerHandler {
Boolean firstRun = true;
public static void handle(List<Case> cases) {
if (firstRun) {
for (Case c : cases) {
c.Edit_Count__c = c.Edit_Count__c + 1;
}
}
firstRun = false;
}
}
C.
public class CaseTriggerHandler {
public static Boolean firstRun = true;
public static void handle(List<Case> cases) {
for (Case c : cases) {
c.Edit_Count__c = c.Edit_Count__c + 1;
}
}
}
D.
trigger on Case (before update) {
Boolean firstRun = true;
if (firstRun) {
CaseTriggerHandler.handle(Trigger.newMap);
}
firstRun = false;
}
33 of 65. Users report that a button on a custom Lightning web component (LWC) is not saving the
data they enter. The button looks to be clicked, but the LWC simply sits there, seemingly doing
nothing.
What should the developer use to ensure error messages are properly displayed?
34 of 65. For compliance purposes, a company is required to track long-term product usage in their
org. The information that they need to log will be collected from more than one object and, over time,
they predict they will have hundreds of millions of records.
A. Big objects
B. Field history tracking
C. Setup audit trail
D. Field audit trail
43 of 65. A company has a custom component that allows users to search for records of a certain
object type by invoking an Apex Controller that returns a list of results based on the user’s input.
When the search is completed, a searchComplete event is fired, with the results put in a results
attribute of the event. The component is designed to be used within other components and may
appear on a single page more than once.
What is the optimal code that should be added to fire the event when the search has completed?
A.
var evt = component.getEvent("searchComplete");
evt.set("{!v.results}", results);
evt.fire();
B.
var evt = component.getEvent("searchComplete");
evt.setParams({results: results});
evt.fire();
C.
var evt = $A.get("e.c:searchComplete");
evt.setParam({results: results});
evt.fire();
D.
var evt = $A.get("e.c:searchComplete");
evt.set("{!v.results}", results);
evt.fire();
Consider the controller code below that is called from an Aura component and returns data wrapped
in a class.
The developer verified that the queries return a single record each and there is error handling in the
Aura component, but the component is not getting anything back when calling the controller
getData(). What is wrong?
A. The member's Name and Option should not be declared public.
B. Instances of Apex classes, such as MyDataWrapper, cannot be returned to a Lightning component.
C. The member's Name and Option should not have getter and setter.
D. The member's Name and Option of the class MyDataWrapper should be annotated with
@AuraEnabled also.
56 of 65. A company has a web page that needs to get Account record information, such as name,
website, and employee number. The Salesforce record ID is known to the web page and it uses
JavaScript to retrieve the account information.
Which method of integration is optimal?
61 of 65. Universal Containers is implementing a new approval process for expense reimbursements.
The process requires complex logic to determine the appropriate approver based on factors such as
expense amount, employee role, and project type. The solution should allow for flexibility and future
changes in the approval rules.
Which approach would be the most suitable for implementing this logic?
A. Use the Salesforce Approval Process feature and define multiple approval steps with entry criteria and
approval assignments.
B. Implement a custom formula field to calculate and determine the appropriate approver based on the
given criteria.
C. Create a custom Apex class with a method to determine the appropriate approver based on the given
criteria.
D. Develop a custom Lightning component to handle the approval logic and integrate it into the expense
reimbursement record page.
63 of 65. Assuming the CreateOneAccount class creates one account and implements the Queueable
interface, which syntax properly tests the Apex code?
A. List<Account> accts;
Test.startTest();
System.enqueueJob( new CreateOneAccount() );
Test.stopTest();
accts = [SELECT Id FROM Account];
System.assertEquals(1, accts.size() );
B. List<Account> accts;
System.enqueueJob( new CreateOneAccount() );
accts = [SELECT Id FROM Account];
System.assertEquals(1, accts.size() );
C. List<Account> accts;
System.enqueueJob( new CreateOneAccount() );
Test.startTest();
System.assertEquals(1, accts.size() );
Test.stopTest();
D. List<Account> accts;
System.enqueueJob( new CreateOneAccount() );
Test.getFlexQueueOrder();
System.assertEquals(1, accts.size() );
22 of 60. A developer is creating a Lightning web component that displays a list of records in a
lightning-datatable. After saving a new record to the database, the list is not updating.
data;
@wire(recordList, {recordId : '$recordId'})
records(result) {
if(result.data){
this.data = result.data;
} else if(result.error){
this.showToast(result.error);
}
}
What should the developer change in the code above for this to happen?
26 of 60. A developer wrote a test class that successfully asserts a trigger on Account. It fires and
updates data correctly in a sandbox environment.
A Salesforce admin with a custom profile attempts to deploy this trigger via a change set into the
production environment, but the test class fails with an insufficient privileges error.
What should a developer do to fix the problem?
A. Configure the production environment to enable "Run All Tests as Admin User."
B. Add @System.runAs() to the test class to execute the trigger as a user with the correct object
permissions.
C. Add seeAllData=true to the test class to work within the sharing model for the production
environment.
D. Verify that Test.startTest() is not inside a FOR loop in the test class.
44 of 60. Universal Containers wants to notify an external system in the event that an unhandled
exception occurs when their nightly Apex batch job runs.
What is the appropriate publish/subscribe logic to meet this requirement?
A. Have the external system subscribe to a standard Platform Event that gets fired.
B. Have the external system subscribe to a standard Platform Event that gets fired with with
EventBus.publish().
C. Have the external system subscribe to a custom Platform Event that gets fired with EventBus.publish().
D. Have the external system subscribe to a custom Platform Event that gets fired with addError().
45 of 60. A developer has working business logic code, but sees the following error in the test class:
You have uncommitted work pending. Please commit or rollback before calling out.
What is a possible solution?
A. Rewrite the business logic and test classes with @TestVisible set on the callout.
B. Use Test.isRunningTest() before making the callout to bypass it in test execution.
C. Call support for help with the target endpoint, as it is likely an external code error.
D. Set seeAllData to true at the top of the test class, since the code does not fail in practice.
52 of 65. Instead of waiting to send emails to support personnel directly from the finish method of a
batch Apex process, Universal Containers wants to notify an external system in the event that an
unhandled exception occurs.
50 of 65. A user receives the generic "An internal server error has occurred" while interacting with a
custom Lightning component.
41 of 65. As part of their quoting and ordering process, a company needs to send PDFs to their
document storage system's REST endpoint that supports OAuth 2.0. Each Salesforce user must be
individually authenticated with the document storage system to send the PDF.
What is the optimal way for a developer to implement the authentication to the REST endpoint?
9 of 65. A corporation has many different Salesforce orgs, with some different objects and some
common objects, and wants to build a single Java application that can create, retrieve, and update
common object records in all of the different orgs.
Which method of integration should the application use?
A. SOAP API with the Partner WSDL
B. Apex REST Web Service
C. SOAP API with the Enterprise WSDL
D. Metadata API
14 of 65. A company wants to run different logic based on an Opportunity's record type.
Which code segment handles this request and follows best practices?
A. RecordType recType_New = [SELECT Id, Name FROM RecordType WHERE SObjectType = 'Opportunity' AND IsActive = True
AND DeveloperName = 'New' LIMIT 1];
RecordType recType_Renewal = [SELECT Id, Name FROM RecordType WHERE SObjectType = 'Opportunity' AND IsActive = True
AND DeveloperName = 'Renewal' LIMIT 1];
for(Opportunity o : Trigger.new) {
if(o.RecordTypeId == recType_New) {
// do some logic Record Type 1
}
else if(o.RecordTypeId == recType_Renewal) {
// do some logic for Record Type 2
}
}
B. List<RecordType> recTypes = [SELECT Id, Name FROM RecordType WHERE SObjectType = 'Opportunity' AND
C. Id recType_New = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('New').getRecordTypeId();
Id recType_Renewal = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get('Renewal').getRecordTypeId();
for(Opportunity o : Trigger.new) {
if(o.RecordTypeId == recType_New) {
// do some logic Record Type 1
}
else if (o.RecordTypeId == recType_Renewal) {
// do some logic for Record Type 2
}
}
16 of 65. When the sales team views an individual customer record, they need to see recent
interactions for the customer. These interactions can be sales orders, phone calls, or Cases. The date
range for recent interactions will be different for every customer record type.
How can this be accomplished?
A. Use batch Apex to query for the most recent interactions when the customer view screen is loaded.
B. Use Lightning Flow to read the customer’s record type, and then do a dynamic query for recent
interactions and display on the View page.
C. Use a Lightning component to query and display interactions based on record type that is passed in
using a design:attribute from the Lightning page.
D. Use a dynamic form on the customer record page to display recent interactions.
53 of 60. Which scenario requires a developer to use an Apex callout instead of Outbound Messaging?
49 of 60. A developer created the code below to perform an HTTP GET request to an external system.
When the code is executed, the callout is unsuccessful and the following error appears within the
Developer Console: System.CalloutException: Unauthorized endpoint.
Which recommended approach should the developer implement to resolve the callout exception?
40 of 60. A developer is building a Lightning web component that searches for Contacts. The
component must communicate the search results to other unrelated Lightning web components, that
are in different DOM trees, when the search completes.
What should the developer do to implement the communication?
34 of 60. Universal Containers needs to integrate with several external systems. The process is initiated
when a record is created in Salesforce. The remote systems do not require Salesforce to wait for a
response before continuing.
What is the recommended best solution to accomplish this?
A. PushTopic event
B. Outbound message
C. Trigger with HTTP callout
D. Platform event
21 of 60. A company has a custom object, Order__c, that has a custom picklist field, Status__c, with
values of 'New', 'In Progress', or 'Fulfilled' and a lookup field, Contact__c, to Contact.
Which SOQL query will return a unique list of all the Contact records that have no 'Fulfilled' Orders?
A. SELECT Id FROM Contact WHERE Id NOT IN (SELECT Contact__c FROM Order__c WHERE Status__c =
'Fulfilled')
B. SELECT Id FROM Contact WHERE Id NOT IN (SELECT Id FROM Order__c WHERE Status__c = 'Fulfilled')
C. SELECT Contact__c FROM Order__c WHERE Status__c <> 'Fulfilled'
D. SELECT Contact__c FROM Order__c WHERE Id NOT IN (SELECT Id FROM Order__c WHERE Status__c =
'Fulfilled')
19 of 60. Which three actions must be completed in a Lightning web component for a JavaScript file in
a static resource to be loaded?
Choose 3 answers
1 of 60. Universal Containers (UC) has an ERP system that stores customer information.
When an Account is created in Salesforce, the ERP system's REST endpoint for creating new customers
must automatically be called with the Account information. If the call to the ERP system fails, the
Account should still be created. Accounts in the UC org are only created, one at a time, by users in the
UC customer on-boarding department.
What should a developer implement to make the call to the ERP system's REST endpoint?
42 of 62. Universal Containers develops a Salesforce application that requires frequent interaction
with an external REST API.
To avoid duplicating code and improve maintainability, how should they implement the API
integration for code reuse?
A. Create a reusable Apex class for the API integration and invoke it from the relevant Apex classes.
B. Use a separate Apex class for each API endpoint to encapsulate the integration logic.
C. Include the API integration code directly in each Apex class that requires it.
D. Store the API integration code as a static resource and reference it in each Apex class.
7 of 60. A developer has a requirement to query three fields (Id, Name, Type) from an Account; and
first and last names for all Contacts associated with the Account.
Which option is the preferred, optimized method to achieve this for the Account named 'Ozone
Electronics'?
B. Account acct = [SELECT ID, Name, Type FROM Account WHERE name='Ozone Electronics'];
List<Contacts> lContacts = [SELECT firstname, lastname FROM Contact WHERE accountid=:acct.ID];
C. Account acct = [SELECT ID, Name, Type, (SELECT FirstName, LastName FROM Contacts) FROM Account
WHERE name='Ozone Electronics' LIMIT 1];
D. List<Accounts> lAccounts = [SELECT ID, Name, Type FROM Account JOIN (SELECT ID, Firstname,
lastname FROM Contact WHERE contacts.account.name = 'Ozone Electronics')];
11 of 60. A page throws an 'Attempt to dereference a null object' error for a Contact.
17 of 60. A developer is asked to replace the standard Case creation screen with a custom screen that
takes users through a wizard before creating the Case. The org only has users running Lightning
Experience.
What should the developer override the Case New Action with to satisfy the requirements?
A. Lightning Page
B. Lightning Record Page
C. Lightning Component
D. Lightning Flow
20 of 60. Which three approaches should a developer implement to obtain the best performance for
data retrieval when building a Lightning web component?
Choose 3 answers
B. Use Salesforce Connect and external data objects to seamlessly import the invoice data into Salesforce
without custom code.
C. Create a cross-reference table in the custom invoicing system with the Salesforce Account ID of each
Customer and insert invoice data nightly.
D. Query the Account Object upon each call to insert invoice data to fetch the Salesforce ID
corresponding to the Customer Number on the invoice.
38 of 60. Just prior to a new deployment the Salesforce administrator, who configured a new order
fulfillment process feature in a developer sandbox, suddenly left the company.
As part of the UAT cycle, the users had fully tested all of the changes in the sandbox and signed off on
them; making the Order fulfillment feature ready for its go-live in the production environment.
Unfortunately although a Change Set was started, it was not completed by the former administrator. A
developer is brought in to finish the deployment.
What should the developer do to identify the configuration changes that need to be moved into
production?
A. In Salesforce setup, look at the last modified date for every object to determine which should be
added to the Change Set.
B. Leverage the Setup Audit Trail to review the changes made by the departed Administrator and identify
which changes should be added to the Change Set.
C. Set up Continuous Integration and a Git repository to automatically merge all changes from the
sandbox metadata with the production metadata.
D. Use the Metadata API and a supported development IDE to push all of the configuration from the
sandbox into production to ensure no changes are lost.
What is the recommended approach to perform validations on more than one field, and display
multiple error messages simultaneously with minimal JavaScript intervention?
A. Try/catch/finally block
C. Validation rules
D. Apex trigger
59 of 60. Universal Containers (UC) wants to develop a customer community to help their customers
log issues with their containers. The community needs to function for their German- and Spanish-
speaking customers also. UC heard that it's easy to create an international community using
Salesforce, and hired a developer to build out the site.
58 of 60. Universal Containers allows customers to log into a Salesforce Community and update their
orders via a custom Visualforce page. Universal Containers' sales representatives can edit the orders
on the same Visualforce page.
What should a developer use in an Apex test class to test that record sharing is enforced on the
Visualforce page?