[go: up one dir, main page]

0% found this document useful (0 votes)
835 views74 pages

Pd2 - Sp24 PDF

Uploaded by

Santiago Camargo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
835 views74 pages

Pd2 - Sp24 PDF

Uploaded by

Santiago Camargo
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 74

Platform Developer 2 – SP24 SET 1

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.

What should the developer ensure to correct these errors?

A. Ensure profiles have access to the Visualforce page.

B. Ensure variables are marked as transient.

C. Ensure queries do not exceed governor limits.

D. Ensure properties are marked as private.

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.

What is the optimal way to accomplish this?

A. Use SingleEmailMessage() with an Apex trigger.

B. Use MassEmailMessage() with an Apex trigger.

C. Use an Email Alert with Flow Builder.

D. Use an Apex trigger with Batch Apex.

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.

Which feature should be utilized to achieve this goal?

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?

A. Check the isCustom() value on the sObject describe result.

B. Check the getObjectType() value for 'Custom' or 'Standard' on the sObject describe result.

C. Use the getCustomObjects() method from the Schema class.

D. Import the list of all custom objects from @salesforce/schema.


10 of 62. A developer used custom settings to store some configuration data that changes occasionally.
However, tests are now failing in some of the sandboxes that were recently refreshed.

What should be done to eliminate this issue going forward?

A. Set the setting type on the custom setting to List.

B. Replace custom settings with static resources.

C. Replace custom settings with custom metadata.

D. Set the setting type on the custom setting to Hierarchy.

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.

Given to the code below:

<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?

A. Add small-device-size="12" to the <lightning-layout-item> elements

B. Add medium-device-size="6" to the <lightning-layout-item> elements

C. Add size="12" medium-device-size="6" to the <lightning-layout-item> elements

D. Add size="6" small-device-size="12" to the <lightning-layout-item> elements

13 of 62. Which technique can run custom logic when a Lightning web component is loaded?

A. Use the connectedCallback() method.

B. Use the renderedCallback() method.

C. Use an aura:handler init event to call a function.

D. Call $A.enqueueAction and pass in the method to call.


15 of 62. Consider the following code snippet:

public class searchFeature{


public static List<List<sObject>> searchRecords(string searchquery){
return [FIND searchquery IN ALL FIELDS RETURNING Account, Opportunity, Lead];
}
}
A developer created the following test class to provide the proper code coverage for the snippet
above:

@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?

A. Change the type of contactInfo to "Map".

B. Move the contents of <c:contactInfo> into the component.

C. Change the default for showContactInfo to "false".

D. Add a change event handler for showContactInfo.

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?

A. Add a try/catch block around the update.

B. Include LastModifiedDate in the query to make sure it wasn't recently updated.

C. Use upsert instead of update.


However, when the test runs, no data is returned and the assertion fails.

Which edit should the developer make to ensure the test class runs successfully?

A. Implement the seeAllData=true attribute in the @IsTest annotation.

B. Enclose the method call within Test.startTest() and Test.stopTest().

C. Implement the setFixedSearchResults method in the test class.

D. Implement the without sharing keyword in the searchFeature Apex class.

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.

What is the optimal way to implement this?

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

C. Apex triggers on Contact and Account that 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

A. Lightning web component

B. Batch Apex

C. Screen Flow

D. Apex method that returns a Continuation object

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?

A. Use REGEX expressions to format the values retrieved via SOQL.

B. Use a wrapper class to format the values retrieved via SOQL.

C. Use the FOR VIEW clause in the SOQL query.

D. Use the FORMAT() function in the SOQL query.


26 of 62. Consider the following code snippet:

<c-selected-order>

<template for:each={orders.data} for:item="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?

A. Create and dispatch a custom event.

B. Create and fire a component event.

C. Create and fire a standard DOM event.

D. Create and fire an application event.

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.

What is the reason this is happening?

A. After triggers are not fired after field updates.

B. Trigger.old does not contain the updated value of the count field.

C. After triggers fire before workflow rules.

D. Trigger.new does not change after a field update.


30 of 62. The head of recruiting at Universal Containers (UC) wants to provide all internal users the
ability to search for open positions by role, department, and location via a new recruiting app. In
addition to search, users of the app should be able to refer a friend, apply for a position, and review
the status of their current submissions.

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?

A. Lightning Experience Builder

B. Salesforce SDK

C. Lightning Web Components

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.

Why does the developer receive a runtime error?

A. The developer used too many savepoints in one trigger session.

B. SP3 became invalid when SP1 was rolled back.

C. The developer has too many DML statements between the savepoints.

D. The developer should have called SP2 before calling SP3.

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?

A. Use multiple @future methods for each process and callout.

B. Use Apex Scheduler to schedule each process.

C. Use Limits class to stop entire process once governor limits are reached.

D. Use Queueable Apex to chain the jobs to run sequentially.


33 of 62. A developer notices the execution of all the test methods in a class takes a long time to run,
due to the initial setup of all the test data that is needed to perform the tests.

What should the developer do to speed up test execution?

A. Define a method that creates test data and annotate with @NeverUseData.

B. Define a method that creates test data and annotate with @TestSetup.

C. Ensure proper usage of test data factory in all test methods.

D. Reduce the amount of test methods in the class.

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.

What should be used to store this data?

A. System.Cookie class

B. Custom settings

C. Static resources

D. Custom metadata

35 of 62. Consider the following code snippet:

public static List<Account> getAccounts(Date thisDate, Id goldenRT){

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?

A. Use the Database.queryLocator method to retrieve the accounts.

B. Annotate the method with the @future annotation.

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?

A. Does not require any JavaScript code

B. Allows for specified re-render targets

C. Does not require any Apex code

D. Supports complex server-side application logic

37 of 62. A developer created a Lightning web component that uses a lightning-record-edit-form to


collect information about Leads. Users complain that they only see one error message at a time about
their input when trying to save a Lead record.

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?

A. Next Best Action

B. Client-side validation

C. Custom validation rules

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?

A. Insert on the Order__c object followed by an update on the Order__c object.

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.

What should the developer do to eliminate the limit exception error?

A. Implement the Queueable Interface.

B. Use the @future annotation.

C. Use platform events.

D. Implement the batchable interface.

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?

A. Use Database.setSavepoint() and Database.rollback() with a try-catch statement.

B. Use Database methods to obtain lists of Database.SaveResults.

C. Use a try-catch and use sObject.addError() on any failures.

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

B. Apex REST Web Service

C. Composite REST 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.

trigger AccountTrigger on Account(before insert) {


AuditAssigner.setAuditor(Trigger.new);
}
public class AuditAssigner {
public static void setAuditor(List<Account> accounts) {
for (User u : [SELECT Id, Audit_Code__c FROM User]) {
}
}
}
What should be changed to most optimize the code's efficiency?

Choose 2 answers

A. Build a Map<String, List<Account>> of audit code to accounts.

B. Add an initial SOQL query to get all distinct audit codes.

C. Add a WHERE clause to the SOQL query to filter on audit codes.

D. Build a Map<Id, List<String>> of Account Id to audit codes.

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. Custom hierarchy setting

C. Custom list setting

D. Custom metadata type


44 of 62. Which Salesforce feature allows a developer to see when a user last logged in to Salesforce if
real-time notification is not required?

A. Asynchronous Data Capture Events

B. Developer Log

C. Calendar Events

D. Event Monitoring Log

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.

Which solution solves these requirements?

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

48 of 62. Universal Containers uses Salesforce to track orders in an Order__c object.

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?

A. User managed sharing

B. Record ownership

C. Criteria-based sharing

D. Apex managed 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.

What is the correct way to fix this?

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

A. SELECT Id FROM Account WHERE Id IN (List of Account Ids)

B. SELECT Id FROM Account WHERE Name IN (List of Names) AND Customer_Number__c = 'ValueA'

C. SELECT Id FROM Account WHERE Name LIKE 'Partner%'

D. SELECT Id FROM Account WHERE Name != ''


52 of 62. A developer is responsible for formulating the deployment process for a Salesforce project.
The project follows a source-driven development approach, and the developer wants to ensure
efficient deployment and version control of the metadata changes.

Which tool or mechanism should be utilized for managing the source-driven deployment process?

A. Salesforce CLI with Salesforce DX

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.

Which two steps should a developer take to accomplish this?

Choose 2 answers

A. Use the @future annotation.

B. Implement the Database.Batchable interface.

C. Implement the Queueable interface.

D. Implement the Schedulable interface.

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.

Which two recommendations should make this process more efficient?

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.

C. Ensure the data in the file is sorted by the order ID.

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?

A. Calling a web service from an Apex trigger

B. Updating a record after the completion of an insert

C. Querying tens of thousands of records

D. Making a call to schedule a batch process to complete in the future

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

B. Apex Test Execution

C. Force.com Migration Tool

D. Salesforce DX CLI

57 of 62. Refer to the test method below:

@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."

What is the optimal way to fix this?

A. Add Test.startTest() before and Test.stopTest() after CalloutUtil.sendAccountUpdate.

B. Add Test.startTest() before and Test.setMock and Test.stopTest() after CalloutUtil.sendAccountUpdate.

C. Add Test.startTest() and Test.setMock before and Test.stopTest() after CalloutUtil.sendAccountUpdate.

D. Add if (Test.isRunningTest()) around CalloutUtil.sendAccountUpdate.


58 of 62. A developer has a test class that creates test data before making a mock callout but now
receives a 'You have uncommitted work pending. Please commit or rollback before calling out' error.

Which step should be taken to resolve the error?

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

A. Call the trigger from the Lightning web component.

B. Leave the business logic code inside the trigger for efficiency.

C. Create a helper class that fetches the high value opportunities.

D. Use custom metadata to hold the high value amount.

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

B. Hierarchy custom setting

C. List custom setting

D. Custom label

2 of 62. The use of the transient keyword in Visualforce page controllers helps with which common
performance issue?

A. Improves query performance

B. Reduces load times

C. Improves page transfers

D. Reduces view state


3 of 62. 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?

A. <design>

<designAttribute name="formFactor" value="Large"/>

</design>

B. <supportedFormFactors>

<supportedFormFactor type="Large"/>

</supportedFormFactors>

C. <lightning:layout formFactor="Large">

</lightning:layout>

D. <property name="formFactor" value="Large"/>

</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?

A. Salesforce Lightning Inspector Event Log tab

B. Salesforce Lightning Inspector Transactions tab

C. Salesforce Lightning Inspector Storage tab

D. Salesforce Lightning Inspector Actions tab


5 of 62. Consider the following code snippet:

<apex:page docType="html-5.0" controller="FindOpportunities">


<apex:form >
<apex:pageBlock >
<apex:pageBlockSection title="Find opportunity">
<apex:input label="opportunity name"/>
<apex:commandButton value="Search" action="{!search}" />
</apex:pageBlockSection>
<apex:pageBlockSection title="Opportunity List" id="opportunityList">
<!-- DATA Table -->
</apex:pageBlockSection>
</apex:pageBlock>
</apex:form>
</apex:page>
Users of this Visualforce page complain that the page does a full refresh every time the Search button
is pressed.

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?

A. Implement the reRender attribute on the apex:commandButton tag.

B. Enclose the DATA table within the apex:actionRegion tag.

C. Ensure the action method search returns null.

D. Implement the apex:actionFunction tag with immediate = true.

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.

What is the optimal way to implement these requirements?

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?

A. Use toLabel(Products__c) in the fields list of the SOQL query.

B. Use the locale clause in the SOQL query.

C. Call the translate() method on each record in the SOQL result list.

D. Set the locale 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.

What is the appropriate publish/subscribe logic to meet this requirement?

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:

<!-- myParentComponent.html -->

<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?

A. let cEvent = new customEvent('passthrough', { detail: 'this.passthrough' });

this.dispatchEvent(cEvent);

B. let cEvent = new customEvent('passthrough');

this.dispatchEvents(cEvent);

C. let cEvent = new CustomEvent('passthrough', { detail: this.passthrough });

this.dispatchEvent(cEvent);

D. let cEvent = new CustomEvent('passthrough');

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.

B. Perform all DML operations from within a future method.

C. Use the Database methods with allOrNone set to false instead of DML statements.

D. Add LIMIT 50000 to every SOQL statement.


12 of 62. A developer created a JavaScript library that simplifies the development of repetitive tasks
and features and uploaded the library as a static resource called jsUtil in Salesforce. Another
developer is coding a new Lightning web component (LWC) and wants to leverage the library.

Which statement properly loads the static resource within the LWC?

A. import jsUtilities from 'salesforce/resourceUrl/jsUtil';

B. const jsUtility = $A.get('$Resource.jsUtil');

C. import {jsUtilities} from '@salesforce/resourceUrl/jsUtil';

D. <lightning:require src="{!$Resource.jsUtil}"/>

15 of 62. A developer is trying to decide between creating a Visualforce component or a Lightning


component for a custom screen.

Which functionality consideration impacts the final decision?

A. Does the screen need to be accessible from the Lightning Experience UI?

B. Will the screen be accessed via a mobile app?

C. Will the screen make use of a JavaScript framework?

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?

Date initialDate = System.Today().addMonths(-12);

Date endDate = System.Today().addMonths(-6);

// Insert SELECT statement here

A. (SELECT AccountId, CreatedDate, Field, NewValue, OldValue

FROM AccountHistory

WHERE CreatedDate >= :initialDate AND CreatedDate <= :endDate);

B. (SELECT AccountId, CreatedDate, Field, NewValue, OldValue

FROM AccountHistory

WHERE CreatedDate >= :endDate AND CreatedDate <= :initialDate);

C. (SELECT AccountId, CreatedDate, Field, NewValue, OldValue

FROM AccountHistory

WHERE CreatedDate BETWEEN :initialDate AND :endDate);

D. (SELECT AccountId, CreatedDate, Field, NewValue, OldValue

FROM AccountHistory

WHERE CreatedDate <= :initialDate AND CreatedDate >= :endDate);


18 of 62. A software company uses a custom object, Defect__c, to track defects in their software.
Defect__c has organization-wide defaults set to private. Each Defect__c has a related list of
Reviewer__c records, each with a lookup field to User that is used to indicate that the User will review
the Defect__c.

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?

A. Lightning web component

B. Criteria-based sharing

C. View All on Defect__c

D. Apex managed sharing

19 of 62. Consider the following code snippet:

trigger OpportunityTrigger on Opportunity (before insert, before update) {


for(Opportunity opp : Trigger.new) {
OpportunityHandler.setPricingStructure(Opp)
}
}

public class OpportunityHandler{


public static void setPricingStructure(Opportunity thisOpp){
Pricing_Structure__c ps = [Select Type__c FROM Pricing_Structure__c WHERE industry__c =
:thisOpp.Account_Industry__c];
thisOpp.Pricing_Structure__c = ps.Type__c;
update thisOpp;
}
}
Which two best practices should the developer implement to optimize this code? Choose 2 answers
A. Change the trigger context to after update, after insert.
B. Remove the DML statement.
C. Use a collection for the DML statement.
D. Query the Pricing_Structure__c records outside of the loop.
20 of 62. 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, ERP_Number__c, that is then used in a query to find matching Accounts.

erpNumber = erpNumber + '%';


List<Account> accounts = [SELECT Id, Name FROM Account WHERE ERP_Number__c LIKE :erpNumber];
A developer receives the exception 'SOQL query not selective enough'.

Which step should be taken to resolve the issue?


A. Mark the ERP_Number__c field as an external ID.
B. Mark the ERP_Number__c field as required.
C. Perform the SOQL query as part of a for loop.
D. Move the SOQL query to within an asynchronous process.

21 of 62. Salesforce users consistently receive a "Maximum trigger depth exceeded" error when saving
an Account.

How can a developer fix this error?

A. Split the trigger logic into two separate triggers.


B. Use a helper class to set a Boolean to TRUE the first time a trigger is fired, and then modify the trigger
to only fire when the Boolean is FALSE.
C. Modify the trigger to use the isExecuting annotation.
D. Convert the trigger to use the @future annotation, and chain any subsequent trigger invocations to
the Account object.

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?

A. Use the standard Account List controller and implement pagination.


B. Upload a third-party data table library as a static resource.
C. Use the transient keyword in the Apex code when querying the Account records.
D. Use JavaScript remoting to query the accounts.
24 of 62. Consider the Apex controller below, that is called from an Aura component.

Line 1 | public class AttributeTypes


Line 2 | {
Line 3 | private final String[] arrayItems;
Line 4 |
Line 5 | @AuraEnabled
Line 6 | public List<String> getStringArray() {
Line 7 | String[] arrayItems = new String[] { 'red', 'green', 'blue' };
Line 8 | return arrayItems;
Line 9 | }
Line 10 | }

What is wrong with this code?

A. Line 1: class must be global


B. Lines 1 and 6: class and method must be global
C. Line 6: method must be static
D. Line 8: method must first serialize the list to JSON before returning

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.

Which feature of Apex code is required to facilitate this solution?

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.

28 of 62. Refer to the following code snippets:

MyOpportunities.js

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

public with sharing class OpportunityController {


@AuraEnabled
public static List<Opportunity> findMyOpportunities(Id oppOwner) {
return [
SELECT Id, Name, Amount
FROM Opportunity
WHERE OwnerId = :oppOwner
];
}
}
When the component is rendered, the following message is displayed: "Error retrieving data".

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.

Which Apex code feature is required to facilitate this solution?

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;

// Add code here

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?

A. AccountControllerExt extension = new AccountControllerExt(acct);


B. ApexPages.StandardController sc = new ApexPages.StandardController(acct.Id); AccountControllerExt
extension = new AccountControllerExt(sc);
C. ApexPages.StandardController sc = new ApexPages.StandardController(acct); AccountControllerExt
extension = new AccountControllerExt(acct);
D. AccountControllerExt extension = new AccountControllerExt(acct.Id);

33 of 62. What are three reasons that a developer should write Jest tests for Lightning web
components? Choose 3 answers

A. To test a component's non-public properties


B. To test basic user interaction
C. To verify the DOM output of a component
D. To test how multiple components work together
E. To verify that events fire when expected

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.

Which is the optimal method to implement this in Salesforce?

A. Apex REST web service


B. Apex REST callout
C. Apex SOAP web service
D. Apex SOAP callout
36 of 62. An Apex trigger creates a Contract record every time an Opportunity record is marked as
Closed and Won. This trigger is working great, except (due to a recent acquisition) historical
Opportunity records need to be loaded into the Salesforce instance.
When a test batch of records are loaded, the Apex trigger creates Contract records. A developer is
tasked with preventing Contract records from being created when mass loading the Opportunities, but
the daily users still need to have the Contract records created.
What is the most extendable way to update the Apex trigger to accomplish this?

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.

What will happen when the mass update occurs?

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:

public static Account[] searchTestAccounts() {


List<List<SObject>> searchList = [FIND 'test' IN ALL FIELDS RETURNING Account(Name)];
return (Account[]) searchList[0];
}
However, the test method below fails.

@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. Test.setFixedSearchResults() method to set up expected data


B. Test.loadData to set up expected data
C. @TestSetup method to set up expected data
D. @isTest(SeeAllData=true) to access org data for the test
45 of 62. A developer is tasked with creating a Lightning web component that allows users to create a
Case for a selected product, directly from a custom Lightning page. The input fields in the component
are displayed in a non-linear fashion on top of an image of the product to help the user better
understand the meaning of the fields.
Which two components should a developer use to implement the creation of the Case from the
Lightning web component? Choose 2 answers

A. lightning-record-edit-form
B. lightning-input-field
C. lightning-input
D. lightning-record-form

47 of 62. A developer created the following test method:


@isTest(SeeAllData=true)
public static void testDeleteTrigger() {
Account testAccount = new Account(name = 'Test1');
insert testAccount;

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?

A. The test will fail.


B. There will be no accounts where the name starts with "Test".
C. There will be five accounts where the name starts with "Test".
D. There will be six accounts where the name starts with "Test".

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

A. Set the IsExposed attribute to true.


B. Specify the target to be lightning__RecordPage.
C. Set the IsVisible attribute to true.
D. Specify the target to be lightning__AppPage.
49 of 62. Universal Containers decided to use Salesforce to manage a new hire interview process. A
custom object called Candidate was created with organization-wide defaults set to Private. A lookup
on the Candidate object sets an employee as an Interviewer.

What should be used to automatically give Read access to the record when the lookup field is set to
the Interviewer user?

A. The record cannot be shared with the current setup.


B. The record can be shared using an Apex class.
C. The record can be shared using a sharing rule.
D. The record can be shared using a permission set.

51 of 62. Refer to the markup below:

<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.

What can the developer do to improve the performance?

A. Add cache="true" to the component.


B. Add density="compact" to the component.
C. Replace layout-type="Full" with fields={fields}.
D. Replace layout-type="Full" with layout-type="Partial".

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.

What should the developer use to implement this integration?

A. An Apex trigger that calls an @future method that allows callouts


B. A platform event that makes a callout to the web application
C. A flow that calls an @future method that allows callouts
D. A flow with an outbound message that contains a session ID
53 of 62. A company manages information about their product offerings in custom objects named
Catalog and Catalog Item. Catalog Item has a master-detail field to Catalog, and each Catalog may have
as many as 100,000 Catalog Items.

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.

Which scenario necessitates that the callout be made in an asynchronous method?

A. The callouts will be made using the REST API.


B. The callout could take longer than 60 seconds to complete.
C. Over 10 callouts will be made in a single transaction.
D. The callouts will be made in an Apex trigger.

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?

A. Set size="12" tablet-device-size="6"


B. Set size="12" medium-device-size="6"
C. Set size="6" mobile-device-size="12"
D. Set size="6" small-device-size="12"
56 of 62. A developer needs to send Account records to an external system for backup purposes. The
process must take a snapshot of Accounts as they are saved and then make a callout to a RESTful web
service. The web service can only receive, at most, one record per call.
What should a developer do to implement these requirements?
A. Implement platform events.
B. Expose an Apex class as a web service.
C. Create a future method.
D. Implement the Queueable interface.

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.

What is the optimal way to implement this?

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?

A. System.QueryException: Too many DML Statement errors on Contact


B. System.LimitException: Too many SOQL Queries on Account
C. System.QueryException: List has more than one row for Assignment on Account
D. System.LimitException: Too many SOQL Queries on Contact

15 of 62. A developer creates an application event that has triggered an infinite loop.

What may have caused this problem?

A. The event has multiple handlers registered in the project.


B. The event is fired from a custom renderer.
C. The event handler calls a trigger.
D. An event is fired 'ontouchend' and is unhandled.

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

A. Apex invocable method


B. Flow Builder
C. Remote action
D. Apex trigger
28 of 62. After a platform event is defined in a Salesforce org, events can be published via which
mechanism?

A. External Apps use an API to publish event messages.


B. Internal Apps can use entitlement processes.
C. External Apps require the standard Streaming API.
D. Internal Apps can use outbound messages.

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 developer received these requirements:


Whenever a product is created or updated in the PIM, a product must be created or updated as a
Product2 record in Salesforce and a PricebookEntry record must be created or updated automatically
by Salesforce.
The PricebookEntry should be created in a Pricebook2 that is specified in a custom setting.
What should the developer use to satisfy these requirements?

A. Invocable Action
B. Custom Apex REST
C. SObject Tree REST
D. Event Monitoring

50 of 62. Refer to the test method below:

@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.

What is the optimal way to fix this?


A. Change the initialization to acct.Number_Of_Times_Viewed__c = 1.
B. Add Test.startTest() before and Test.stopTest() after AuditUtil.incrementViewed.
C. Add Test.startTest() before and Test.stopTest() after insert acct.
D. Change the assertion to System.assertEquals(0, acctAfter.Number_Of_Times_Viewed__c).
55 of 62. A developer implemented a custom data table in a Lightning web component with filter
functionality. However, users are submitting support tickets about long load times when the filters are
changed. The component uses an Apex method that is called to query for records based on the
selected filters.

What should the developer do to improve performance of the component?

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?

A. Use a Database Savepoint method with a try-catch block.


B. Use setSavePoint() and rollback() with a try-catch block.
C. Use the Database.Delete method if the Contact insertion fails.
D. Use the Database.Insert method with allOrNone set to false.

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.

What is the optimal way to automate this?

A. Use Database.executeBatch() to invoke a Queueable class.


B. Use Database.executeBatch() to invoke a Database.Batchable class.
C. Use System.enqueueJob() to invoke a Queueable class.
D. Use System.scheduleJob() to schedule a Database.Schedulable class.
3 of 62. 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?

A. Ensure that Disable Parallel Apex Testing is unchecked.


B. Ensure test classes are using SeeAllData = true.
C. Ensure the sandbox is on the same release as production.
D. Ensure the Apex classes are on the same API version.

4 of 62. A developer created a class that implements the Queueable Interface, as follows:

public class without sharing OrderQueueableJob implements Queueable {


public void execute(QueueableContext context) {
// implementation logic
System.enqueueJob(new FollowUpJob());
}
}
As part of the deployment process, the developer is asked to create a corresponding test class.

Which two actions should the developer take to successfully execute the test class?
Choose 2 answers

A. Enclose System.enqueueJob(new OrderQueueableJob()) within Test.startTest and Test.stopTest().


B. Implement seeAllData=true to ensure the Queueable job is able to run in bulk mode.
C. Ensure the running user of the test class has, at least, the View All permission on the Order object.
D. Implement Test.isRunningTest() to prevent chaining jobs during test execution.

6 of 62. A Salesforce developer is hired by a multi-national company to build a custom Lightning


application that shows employees their employment benefits and earned commissions over time. The
application must acknowledge and respect the user's locale context for dates, times, numbers,
currency, and currency symbols.

When using Aura components, which approach should the developer implement to ensure the
Lightning application complies with the user's locale?

A. Create a Hierarchical custom setting to store user preferences.


B. Use the $Locale value provider to retrieve the user preferences.
C. Use the $User global variable to retrieve the user preferences.
D. Use the $Label global value provider.
8 of 62. Refer to the code snippet below:

public static void updateCreditMemo(String customerId, Decimal newAmount) {


List<Credit_Memo__c> toUpdate = new List<Credit_Memo__c>();
for(Credit_Memo__c creditMemo : [Select Id, Name, Amount__c FROM Credit_Memo__c WHERE
Customer_Id__c = :customerId LIMIT 50]){
creditMemo.Amount__c = newAmount;
toUpdate.add(creditMemo);
}
Database.update(toUpdate,false);
}
A custom object called Credit_Memo__c exists in a Salesforce environment. As part of a new feature
development that retrieves and manipulates this type of record, the developer needs to ensure race
conditions are prevented when a set of records are modified within an Apex transaction.

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.

What should be used?


A. Component Event
B. DML Operation
C. Application Event
D. ChangeLog

12 of 62. Which code snippet processes records in the most memory efficient manner, avoiding
governor limits such as "Apex heap size too large"?

A. List<Opportunity> opportunities = [SELECT Id, Amount from Opportunity]; for(Opportunity opp:


opportunities){
// perform operation here
}

B. For(Opportunity opp: [SELECT Id, Amount from Opportunity]){


// perform operation here
}

C. Map<Id, Opportunity> opportunities = new Map<Id, Opportunity>([SELECT Id, Amount from


Opportunity]);
for(Id oppId: opportunities.keySet()){
// perform operation here
}

D. List<Opportunity> opportunities = Database.query('SELECT Id, Amount from Opportunity');


for(Opportunity opp: opportunities){
// perform operation here
}

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.

Which Salesforce feature can help achieve this requirement?


A. Criteria-based sharing rules
B. Apex managed sharing
C. Sharing sets
D. Role hierarchy
14 of 62. An org has an existing process, built using Process Builder, on Opportunity that sets a custom
field, CommissionBaseAmount__c, when an Opportunity is edited and the Opportunity's Amount
changes.

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.

Which action should the developer take to correct this problem?


A. Replace the process with a Fast Field Update record-trigger flow.
B. Call the trigger from the process.
C. Call the process from the trigger.

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.

What can a developer do to address the issue?


A. Move the prerequisite reference data setup to a @testSetup method in the test class.
B. Move the prerequisite reference data setup to a TestDataFactory and call that from each test method.
C. Move the prerequisite reference data setup to the constructor for the test class.
D. Turn off triggers, flows, and validations when running tests.

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.

What is the optimal way to achieve this?


A. Create an Apex class, execute a Future method from it, and make a callout from the Future method.
B. Create an Apex trigger, execute a Queueable job from it, and make a callout from the Queueable job.
C. Create a Before Save Flow, execute a Queueable job from it, and make a callout from the Queueable
job.
D. Create an Apex class, execute a Batch Apex job from it, and make a callout from the Batch Apex job.
24 of 62. Refer to the code:

01 <!-- Lightning Web Component HTML file -->


02 <template>
03 <lightning-button label="Call server" onclick={handleClick}></lightning-button>
04 </template>
05 // Lightning Web Component JS file
06 import { LightningElement } from 'lwc';
07 import serverEcho from '@salesforce/apex/SimpleServerSideController.serverEcho';
08
09 export default class Helloworld extends LightningElement {
10 firstName = 'world';
11 handleClick() {
12 serverEcho({ firstName: this.firstName })
13 .then((result) => {
14 alert('From server: ' + result);
15 })
16 .catch((error) => {
17 console.error(error);
18 });
19 }
20 }

01 // Apex Controller for Lightning Component


02
03 public with sharing class SimpleServerSideController {
04 @AuraEnabled
05 public static String serverEcho(sObject firstName) {
06 String firstNameStr = (String)firstName.get('firstName');
07 return ('Hello from the server, ' + firstNameStr);
08 }
09 }

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.

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?

A. @wire(getRecord, { recordId: '$recordId', fields: '$fields' })

B. @api(getRecord, { recordId: '$recordId' })


Get the fields in renderedCallback() and assign them to record.

C. @wire(getRecord, { recordId: '$recordId' })


Get the fields in connectedCallback() and assign them to record.
30 of 62. A company's support process dictates that any time a case is closed with a status of 'Could
not fix,' an Engineering Review custom object record should be created and populated with
information from the case, the contact, and any of the products associated with the case.

What is the correct way to automate this using an Apex trigger?

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

32 of 62. Which statement is true regarding savepoints?

A. Static variables are not reverted during a rollback.


B. You can roll back to any savepoint variable created in any order.
C. Reference to savepoints can cross trigger invocations.
D. Savepoints are not limited by DML statement governor limits.

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

A. Use the private keyword in the controller for variables.


B. Use the final keyword in the controller for variables that will not change.
C. Use the transient keyword in the Apex controller for variables that do not maintain state.
D. Refine any SOQL queries to return only data relevant to the page.
E. Use filters and pagination to reduce the amount of data.

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.

What is the optimal technique for a developer to troubleshoot this?

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:

01 public class with sharing AccountsController {


02
03 @AuraEnabled
04 public List<Accounts> getAllAccounts() {
05 return [Select Id, Name, Industry FROM Account];
06 }
07
08 }

As part of the deployment cycle, a developer creates the following test class:

01 private class with sharing AccountsController_Test {


02
03 @TestSetup
04 private static void makeData() {
05 User user1 = [Select Id FROM User WHERE Profile.Name = 'System Administrator' and isActive =
true LIMIT 1 ];

List<Account> result = AccountsController.getAllAccounts();


System.assertEquals(20, result.size());

When the test class runs, the assertion fails.

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.

01 public class AccountSearcher {


02
03 public static List<AccountWrapper> search(String term) {
04 List<AccountWrapper> wrappers = getMatchingAccountWrappers(term);
05 return wrappers;
06 }
07
08 }
09
10 public class AccountWrapper {
11 public Account { get; set; }
12 public Decimal matchProbability { get; set; }
13 // ...other methods, including getMatchingAccountWrappers implementation...
14 }
Which two changes should the developer make so the Apex method functions correctly?
Choose 2 answers

A. Add @AuraEnabled to lines 11 and 12.


B. Add @AuraEnabled to line 09.
C. Add @AuraEnabled to line 03.
D. Add @AuraEnabled to line 01.

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. Set the sObject type as a component attribute.


B. Use the getSObjectType() method in an Apex class.
C. Add force:hasSObjectName to the implements attribute.
D. Create a design attribute and configure via App Builder.
42 of 62. A Visualforce page loads slowly due to the large amount of data it displays.

Which strategy can a developer use to improve the performance?

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.

What might cause this to happen?

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?

A. SOQL for loop that counts the number of Opportunities records


B. Apex batch job that counts the number of Opportunity records
C. SUM() SOQL aggregate query on the Opportunity object
D. COUNT() SOQL aggregate query on the Opportunity object
47 of 62. Consider the queries in the options below and the following information:

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

A. SELECT Id FROM Account WHERE Id IN :listVariable


B. SELECT Id FROM Account WHERE Name != NULL
C. SELECT Id FROM Account WHERE Name != '' AND IsDeleted = false
D. SELECT Id FROM Account WHERE Name != '' AND Customer_Number__c = 'valueA'

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.

What can cause this problem?

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:

public class LeadController {


public static List<Lead> getFetchLeadList(String searchTerm, Decimal aRevenue) {
String safeTerm = '%' + searchTerm.escapeSingleQuote() + '%';
return [
SELECT Name, Company, AnnualRevenue
FROM Lead
WHERE AnnualRevenue >= :aRevenue
AND Company LIKE :safeTerm
LIMIT 20
];
}
}

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

A. Use the WITH SECURITY_ENFORCED clause within the SOQL query.


B. Implement the with sharing keyword in the class declaration.
C. Annotate the Apex method with @AuraEnabled.
D. Annotate the Apex method with @AuraEnabled(Cacheable=true).
E. Implement the without sharing keyword in the class declaration.
53 of 62. Consider the Apex class below that defines a RemoteAction used on a Visualforce search
page.

global with sharing class MyRemoter {


public String accountName { get; set; }
public static Account account { get; set; }
public MyRemoter() {}

@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);

B. MyRemoter remote = new MyRemoter('TestAccount');


Account a = remote.getAccount();
System.assertEquals('TestAccount', a.Name);

C. MyRemoter remote = new MyRemoter();


Account a = remote.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:

HttpRequest req = new HttpRequest();


req.setEndpoint('https://TestEndpoint.example.com/some_path');
req.setMethod('GET');
Blob headerValue = Blob.valueOf('myUserName' + ':' + 'strongPassword');
String authorizationHeader = 'BASIC ' + EncodingUtil.base64Encode(headerValue);
req.setHeader('Authorization', authorizationHeader);
Http http = new Http();
HTTPResponse res = http.send(req);
Which two steps should the developer take to add flexibility to change the endpoint and credentials
without needing to modify code?

Choose 2 answers

A. Use req.setEndpoint('callout:endPoint_NC'); within the callout request.


B. Store the URL of the endpoint in a custom Label named endPointURL.
C. Create a Named Credential, endpoint_NC, to store the endpoint and credentials.
D. Use req.setEndpoint(Label.endPointURL);

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?

A. SELECT * FROM Account WHERE Name = 'Acme' LIMIT 1

B. SELECT FIELDS FROM Account WHERE Name = 'Acme' LIMIT 1

C. SELECT ALL FROM Account WHERE Name = 'Acme' LIMIT 1

D. SELECT FIELDS(ALL) FROM Account WHERE Name = 'Acme' LIMIT 1

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.

public void updateAndMakeCallout(Map<Id, Request__c> reqs, Map<Id, Request_Line__c> reqLines) {


Savepoint sp = Database.setSavepoint();
try {
insert reqs.values();
insert reqLines.values();
HttpResponse response = CalloutUtil.makeRestCallout(reqs.keySet(), reqLines.keySet());
} catch (Exception e) {
Database.rollback(sp);
System.debug(e);
}
}
The CalloutUtil.makeRestCallout fails with a 'You have uncommitted work pending. Please commit or
rollback before calling out' error.

What should be done to address the problem?

A. Change the CalloutUtil.makeRestCallout to an @future method.

B. Move the CalloutUtil.makeRestCallout method call below the catch block.

C. Remove the Database.setSavepoint and Database.rollback.

D. Change the CalloutUtil.makeRestCallout to an @InvocableMethod method.


23 of 65. A Visualforce page contains an industry select list and displays a table of Accounts that have
a matching value in their Industry field.

<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.

What is the optimal way to implement this?

A. Add an apex:actionFunction within the apex:selectOptions.

B. Add an apex:actionFunction within the apex:selectList.

C. Add an apex:actionSupport within the apex:selectList.

D. Add an apex:actionSupport within the apex:selectOptions.

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.

How should a developer implement the callouts?

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.

What might be causing the failed assertion?

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?

A. Boolean show = User_Prefs__c.Show_Help__c;


B. Boolean show = User_Prefs__c.getValues(UserInfo.getUserId()).Show_Help__c;
C. Boolean show = User_Prefs__c.getInstance().Show_Help__c;
D. Boolean show = User_Prefs__c.getValues().Show_Help__c;

31 of 65. An Apex trigger and Apex class increment a counter, Edit_Count__c, any time the Case is
changed.

public class CaseTriggerHandler {


public static void handle(List<Case> cases) {
for (Case c : cases) {
c.Edit_Count__c = c.Edit_Count__c + 1;
}
}
}

trigger on Case (before update) {


CaseTriggerHandler.handle(Trigger.new);
}
A new before-save record-triggered flow on the Case object was just created in production for when a
Case is created or updated. Since the process was added, there are reports that Edit_Count__c is being
incremented more than once for Case edits.

Which Apex code fixes this problem?

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;
}
}

trigger on Case (before update) {


if (CaseTriggerHandler.firstRun) {
CaseTriggerHandler.handle(Trigger.new);
}
CaseTriggerHandler.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;
}
}

trigger on Case (before update) {


CaseTriggerHandler.firstRun = true;
if (CaseTriggerHandler.firstRun) {
CaseTriggerHandler.handle(Trigger.new);
}
CaseTriggerHandler.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;
}
}
}

trigger on Case (before update) {


if (CaseTriggerHandler.firstRun) {
CaseTriggerHandler.handle(Trigger.new);
}
CaseTriggerHandler.firstRun = false;
}

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?

A. Add JavaScript and HTML to display an error message.


B. Add the apex:messages/ tag to the component.
C. Use the Database method with allOrNone set to false.
D. Add a try-catch block surrounding the DML statement.

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.

What should a developer use to implement this?

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.

public class MyServiceController {


@AuraEnabled
public static MyDataWrapper getData(String theType) {
Some_Object__c someObj = [SELECT Id, Name FROM Some_Object__c WHERE Type__c =: theType
LIMIT 1];
Another_Object__c anotherObj = [SELECT Id, Option__c FROM Another_Object__c WHERE
Some_Object__c.Id = someObj.Id LIMIT 1];
MyDataWrapper theData = new MyDataWrapper();
theData.Name = someObj.Name;
theData.Option = anotherObj.Option__c;
return theData;
}

public class MyDataWrapper {


public String Name {get; set;}
public String Option {get; set;}
public MyDataWrapper() {}
}

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?

A. Apex REST web service


B. SOAP API
C. REST API
D. Apex SOAP web service
58 of 65. A company has many different unit test methods that create Account records as part of their
data setup. A new required field was added to the Account and now all of the unit tests fail.
What is the optimal way for a developer to fix the issue?
A. Change the required field to be a validation rule that excludes the System Administrator profile.
B. Add a before insert trigger on Account to set the value of the required field.
C. Add the required field to the data setup for all of the unit tests.
D. Create a TestDataFactory class that serves as the single place to create Accounts for unit tests and set
the required field there.

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?

A. Add the @track decorator to the data variable.


B. Create a variable to store the result and call refreshApex().
C. Call refreshApex() on this.data.
D. Create a new variable to store the result and annotate it with @track.

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.

What is the appropriate publish/subscribe logic to meet this requirement?

A. Publish the error event using the EventBus.publish() method.


B. No publishing is necessary. Have the external system subscribe to the BatchApexErrorEvent.
C. Publish the error event using the addError() method.
D. Publish the error event with a Flow.

50 of 65. 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?

A. Add an onerror event handler to the tag.


B. Add an error-view component to the markup.
C. Use platform events to process the error.
D. Use an AuraHandledException in a try-catch block.

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?

A. Named Credential with an OAuth Authentication Provider


B. Named Credential with Password Authentication
C. Hierarchy Custom Setting with an OAuth token custom field
D. Hierarchy Custom Setting with a password custom field
64 of 65. A developer is working on an integration between Salesforce and an external system. The
integration requires sending a large amount of data to the external system, which can cause long
response times and timeouts.
To optimize the performance and avoid timeouts, which technique should be used?
A. Use a chained batch Apex to split the data into smaller batches.
B. Implement an asynchronous callout using the Continuation class.
C. Increase the timeout limit in the callout options.
D. Use the @future annotation to make the callout asynchronous.

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?

A. The target system uses a REST API.


B. The target system uses a SOAP API.
C. The callout needs to be asynchronous.
D. The callout needs to be invoked from a flow.

49 of 60. A developer created the code below to perform an HTTP GET request to an external system.

public class ERPCatalog {


private final ERP_CATALOG_URL = 'http://sampleCatalog.com/cat/';

public String getERPCatalogContents() {


Http h = new Http();
HttpRequest req = new HttpRequest();
req.setEndpoint(ERP_CATALOG_URL);
req.setMethod('GET');

HttpResponse res = h.send(req);


return res.getBody();
}
}

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?

A. Annotate the getERPCatalogContents method with @Future(Callout=true).


B. Change the access modifier for ERPCatalog from public to global.
C. Use the setHeader() method to specify Basic Authentication.
D. Create a remote site setting configuration that includes the endpoint.
44 of 60. An Apex class does not achieve expected code coverage. The testSetup method explicitly calls
a method in the Apex class.

How can the developer generate the code coverage?

A. Use System.assert() in testSetup to verify the values are being returned.


B. Verify the user has permissions passing a user into System.runAs().
C. Call the Apex class method from a testMethod instead of the testSetup method.
D. Add @testVisible to the method in the class the developer is testing.

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?

A. Fire an application event.


B. Publish an event on an event channel.
C. Fire a custom component event.
D. Publish a message on a message channel.

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

A. Import the static resource.


B. Reference the static resource in a <script> tag.
C. Call loadScript.
D. Import a method from the platformResourceLoader.
E. Append the static resource to the DOM.

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?

A. REST call from JavaScript


B. Headless Quick Action
C. Call a Queueable from a Trigger
D. Apex Continuation

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'?

A. List<Contacts> lContacts = new List<Contacts>();


for (Contact con : [SELECT firstname, lastname, Account.Name, Account.ID, Account.Type FROM Contact
]) {
if(con.AccountName == 'Ozone Electronics'){ lContacts.add(con);}
}

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.

What change in the controller will fix the error?

A. Declare a static final Contact at the top of the controller.


B. Use a condition in the getter to return a new Contact if it is null.
C. Change the setter's signature to return a Contact.
D. Change the getter's signature to be static 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

A. Use lazy load for occasionally accessed data.


B. Use layoutType: ['full'] to display a set of fields.
C. Use the Lightning Data Service.
D. Use getRecords() to obtain metadata.
E. Use @cacheable=true whenever possible.

23 of 60. Given the following information regarding Universal Containers (UC):

UC represents their customers as Accounts in Salesforce.


All customers have a unique Customer_Number__c that is unique across all of UC's systems.
UC also has a custom Invoice__c object, with a Lookup to Account, to represent invoices that are sent
out from their external system.
UC wants to integrate invoice data back into Salesforce so Sales Reps can see when a customer pays
their bills on time.

What is the optimal way to implement this?

A. Ensure Customer_Number__c is an External ID and that a custom field Invoice_Number__c is an


External ID and Upsert invoice data nightly.

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.

56 of 60. A developer created a Lightning web component that uses a lightning-record-edit-form to


collect information about Leads. Users complain that they only see one error message at a time about
their input when trying to save a Lead record.

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

B. External JavaScript library

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.

What should the developer use to ensure the site is multilingual?

A. Use custom labels to ensure custom messages are translated properly.

B. Use custom settings to ensure custom messages are translated properly.

C. Use custom objects to translate custom picklist values.

D. Use custom metadata to translate custom picklist values.

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?

A. Use System.profileId() to test as a sales rep and a community user.

B. Use System.profileId() to test as an administrator and a community user.

C. Use System.runAs() to test as a sales rep and a community user.

D. Use System.runAs() to test as an administrator and a community user.

You might also like