Professional Documents
Culture Documents
PD2 (4) Done
PD2 (4) Done
Q. 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?
Q. 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?
Answer: The test class has not re-queried the Account record after updating the Opportunity.
Q. 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 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?
Answer: A Database. Schedulable and Database. Batchable class that queries the Catalog Item
object and updates the Catalog Items if the Catalog CurrencyIsoCode is different
<aura:component>
<br/>
</aura:component>
Which two interfaces can the developer implement to make the component available as a quick
action? Choose 2 answers.
Answer: force:lightningQuickAction
02 Account parentAccount;
03
06
07 insert (newContact);
08 }
As part of an integration development effort, a developer is tasked to create an Apex method that
solely relies on the use of foreign Identifiers in order to relate new contact records to existing
Accounts in Salesforce. The account object contains a field marked as an external ID, the API Name
of this field is Legacy_Id__c.
What is the most efficient way to instantiate the parentAccount variable on line 02 to ensure the newly
created contact is properly related to the Account ?
Q. Which three Visualforce components can be used to initiate Ajax behavior to perform partial page
updates?
Choose 3 answers
Answer:
<apex: commandButton>
<apex:commandLink>
<apex:actionSupport>
Q. Which statement is considered a best practice for writing bulk safe Apex triggers?
Answer: Add records to collections and perform DML operations against these collections.
public MyRemoter() { }
@Remotection
account = (SELECT ID, Name, Number Employees EROM Account WHERE Name = : account
Name);
return account.
Consider the Apex class above that defines a Remote Action used on a Visualforce search page.
Which code snippet will assert that the remote action returned the correct Account?
Q. When calling a RESTful web service, the developer must implement two-way SSL authentication
to enhance security. The Salesforce admin has generated a self-sign certificate within Salesforce with
a unique name of "ERPSecCertificate".
Which method must the developer implement in order to sign the HTTP request with the certificate?
Answer: reg.setClientCertificateName('ERPSecCertificate');
Q. A developer created a JavaScript library that simplifies the development of repetitive tasks and
features and uploaded the library as a static resource called jsutils 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?
Q. A company has reference data stored in multiple custom metadata records that represent default
information and delete behaviour 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.
Choose 2 answers
Answer: Create the application using Lightning Web Components wrapped in Aura Components.
Q. 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_Numero__c, that is then used in a query to find matching Accounts.
List <Account> accounts = (SELECT Id, Name FROM Account WHERE ERP_Number_c LIKE
:erplumber]
Q. A developer has a test class that creates test data before making a mock callout but now receives
a 'You have uncommitted work pending.
Answer: Ensure the records are inserted before the Test.startest() statement and the mock callout
occurs after the Test.startTest().
Q. There is an Apex controller and a Visualforce page in an org that displays records with a custom
filter consisting of a combination of picklist values selected by the user.
The page takes too long to display results for some of the input combinations, while for other input
choices it throws the exception, "Maximum view state size limit exceeded".
Answer: Use a StandardSetController or SOQL LIMIT in the Apex controller to limit the number of
records displayed at a time.
Q. 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?
Q. 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.
Answer: Define a method that creates test data and annotate with test setup.
Q. Ursa Major Solar has a custom object, Service Job_e, with an optional Lookup field to Account
called Partner_Service_Provider_c. The Totaljobs_c field on Account tracks the total number of
ServiceJob_c records to which a partner service provider Account is related.
What should be done to ensure that the totaljobs_c field is kept up to date?
Q. An Apex trigger and Apex class increment a counter, Edit_Count_c, any time the Case is
changed.
c. Edit_Count_c = c.Edit_count_c + 1;
A new process 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.
c. Edit_count_c = c. Edit_Count__ + 1;
if (CageTriggerHandler.firstRun) {
CaseTrigger Handler.handle(Trigger.new);
Q. A company represents their customers as Accounts that have an External ID field called
Customer_Number__c. They have a custom Order (Order_c) object, with a Lookup to Account, to
represent Orders that are placed in their external order management system (OMS). When an order
is fulfilled in the OMS, a REST call to Salesforce should be made that creates an Order record in
Salesforce and relates it to the proper Account.
Answer: Perform a REST PATCH to upsert the Order_c and specify the Account's
Customer_Number_c in it.
Q. 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.
public static void updateCreditMemo (String customer Id, Decimal new Amount) {
for (Credit_Memo__c creditMemo: [Select Id, Name, Amount_c FROM Credit Memec WHERE
Customer Id LIMIT 50]) {
credstMemo. Amount_c= new Amount;
toUpdate.add(creditMemo);
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 w 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?
Answer: [Select Id, Name, Amount_c FROM Credit_Memo__c WHERE customer_id_c =: customerId
LIMIT 50 FOR UPDATE]
Q. Which two scenarios require an Apex method to be called imperatively from a Lightning web
component?
Choose 2 answers
Q. 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?
Q. A company wants to build a custom Aura component that displays a specified Account Field Set
and that can only be added to the Account record page.
<sfdc:objects>
<sfdc:object>Account</sfdc:object>
</sfdc:objects>
</design:component>
Q. 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
Answer: Refine any SOQL queries to return only data relevant to the page.
Use the transient keyword in the Apex controller for variables that do not maintain state.
Q. An Apex class does not achieve expected code coverage. The test Setup method explicitly calls a
method in the Apex class. How can the developer generate the code coverage?
Answer: Call the Apex class method from a testMethod instead of the testSetup method.
Q. A business process requires sending new Account records to an external system. The Account
Name, Id, CreatedDate, and CreatedById must be passed to the external system in near real-time
when an Account is inserted without error. How should a developer achieve this?
Q. 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?
Answer: The test class does not retrieve the updated value from the database.
Q. 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?
Q. 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?
Answer: Apex triggers on Contact and Account that call a helper class to normalize the address.
Q. The Salesforce admin at Cloud Kicks created a custom object called Region_c to store all postal
zip codes in the United States and the Cloud Kicks sales region the zip code belongs to.
Object Name:
Region_c
Fields:
Zip_Code__c (Text)
Region_Name_c (Text)
Cloud Kicks wants a trigger on the Lead to populate the Region based on the Lead's zip code.
Which code segment is the most efficient way to fulfill this request?
Answer:
}
Q. Refer to the code snippet below:
@wire(fetchopps)
Opportunities;
When a Lightning web component is rendered, a list of opportunities that match certain criteria should
be retrieved from the database and displayed to the end-user.
Which three considerations must the developer implement to make the fetchopportunities method
available within the Lightning web component?
Choose 3 answers
Answer:
The method cannot mutate the result set retrieved from the database.
Q. 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'?
Answer: Account a = [SELECT ID, Name, Type, (SELECT FirstName, LastName FROM Contacts)
FROM Account WHERE name='Ozone Electronics' LIMIT 1];
Q. Consider the following queries. For these queries, assume that there are more than 200,000
Account records. These records include softdeleted records; that is, deleted records that are still in
the Recycle Bin. Note that there are two fields that are marked as External Id on the Account. These
fields are Customer_Number_c and ERP_Key_c.
Choose 2 answers
Answer: SELECT Id FROM Account WHERE Name != '' AND Customer_Number_c = 'ValueA’
Q. 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?
Answer: Create a TestDataFactory class that serves as the single place to create Accounts for unit
tests and set the required field there.
Q. A developer needs to store variables to control the style and behavior of a Lightning Web
Component.
Which feature should be used to ensure that the variables are testable in both Production and all
Sandboxes?
Answer:
Custom Metadata
Q. A company uses their own custom-built enterprise resource planning (ERP) system to handle
order management. The company wants Sales Reps to know the status of orders so that if a
customer calls to ask about their shipment, the Sales Rep can advise the customer about the order's
status and tracking number if it has shipped.
Which two methods can make this ERP order data visible in Salesforce?
Choose 2 answers
Answer: Have the ERP system push the data into Salesforce using the SOAP API.
Use Salesforce Connect to view real-time Order data in the ERP system.
Question: 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?
Question:
Question
Region_c theRegion = [
accountList.add( anaccount);
update accountList;
Consider the above trigger intended to assign the Account to the manager of the Account's region,
Which two changes should a developer make in this trigger to adhere to best practices?
Choose 2 answers
Answer:
Question:
Refer to the following code snippet:
return [
SELECT Name, Company, Annual Revenue FROM Lead WHERE Annual Revenue >= :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 getFetchteadList 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
Question:
Apex Class:
Component markup:
<aura:component>
</aura:component>
Component controller:
{{
if (state == "SUCCESS") {
});
$A.enqueuection (action);
A developer is building this Aura component to display information about top Opportunities in the org.
Which three code changes must be made for the component to work?
Choose 3 answers
Question: Just prior to a new deployment the Salesforce administrator, who configured a new order
fulfilment 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 fulfilment 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?
Answer: 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.
Question
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?
Question: 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.
Answer: Add system.debug() statements to the code and use the Developer Console logs to trace the
code
Question: After a Platform Event is defined in a Salesforce org, events can be published via which two
mechanisms?
Choose 2 answers
Question:
A developer is building a Lightning web component that retrieves data from Salesforce and assigns it
to the record property.
@api fields;
@api recordId;
record;
What must be done in the component to get the data from Salesforce?
Answer:
Question: An org has a requirement that the Shipping Address on the Account must be validated by a
third-party web service before the Account is
allowed to be inserted. This validation must happen in real-time before the account is inserted into the
system. Additionally, the developer wants to prevent the consumption of unnecessary SME
statements.
Answer: Make a callout to the web service from a custom Visualforce controller.
Question: 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.
Question: What is the optimal technique a developer should use to programmatically retrieve Global
Picklist options in a test method?
Question: A company wants to run different logic based on an opportunity's record type.
Which code segment handles this request and follows best practices?
Answer:
Id recType_New =
Id recType_Renewal =
Question: A developer is trying to access org data from within a test class.
Which sObject type requires the test class to have the (see AllData=true) annotation?
Answer: Report
Question: In an organization that has multi-currency enabled, a developer is tasked with building a
Lighting component that displays the top ten Opportunities most recently accessed by the logged in
user. The developer must ensure the amount and Last ModifiedDate 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?
Question: Universal Containers implements a private sharing model for the Convention_Attendee_e
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?
Answer: Create an After Insert trigger on the Convention Attendee custom object, and use Apex
Sharing Reasons and Apex Managed Sharing
Question:
<lightning:button label="Save" onclick="{!c.handleSave}"/>
({
})
A company has the Lightning Component above that allows users to click a button to save their
changes and redirects them to a different page. Currently, when the user hits the Save button the
records are getting saved, but they are not redirected.
Which three techniques can a developer use to debug the JavaScript? Choose 3 answers
Answer: Enable Debug Mode for Lightning components for the user.
Question:
<Template>
<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.
Question: A managed package uses a list of country ISO codes and country names as reference data
in many different places from within the managed
Answer: Store the information in custom metadata and access it with the getall() method.
Question:
@isTest
Datafactory.setupDataForMyTriggerTest();
//Utility to asser all accounts are not customers before the update
AssertUtil.assertNotCustomers(acctBefore);
For(Account a : Datafactory.accounts)
a.Is_Customer__c=true;
Update Datafactory.accounts;
AssertUtil.assertNumberOfTransfers(acctsAfter);
The test method above tests an Apex trigger that the developer knows will make a lot of queries when
a lot of Accounts are simultaneously updated to be customers.
The test method fails at the line 20 because of too many soql queries.
Answer: Add Test.startTest() before line 18 of the code and add Test.stopTest() after line 18 of the
code.
What is the recommended approach to perform validations on more than one field, and display
multiple error messages simultaneously with minimal JavaScript intervention?
Question: company uses their own custom-built enterprise resource planning (ERP) system to handle
order management. The company wants Sales Reps to know the status of orders so that if a
customer calls to ask about their shipment, the Sales Rep can advise the customer about the order's
status and tracking number if it has shipped.
Which two methods can make this ERP order data visible in Salesforce? Choose 2 answers
Answer: Use Salesforce Connect to view real-time Order data in the ERP system
Have the ERP system push the data into Salesforce using the SOAP API.
Question: Which three approaches should a developer implement to obtain the best performance for
data retrieval when building a Lightning web component? Choose 3 answers
Question: Which tag should a developer use to display different text while an <apex:commandButton>
processing an action?
Answer: <apex:actionstatus>
Question: 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.
Answer: Write a single trigger on Contact for both after update and before update and callout to
helper classes to handle each set of logic.
Question: Consider the controller code below that is called from an Aura component and returns data
wrapped in a class.
@AuraEnabled
Public static MyDataWrapper getSomeData { String theType) {
Some_Object_c someobj =[ SELECT ID, Name FROM Some_object_c WHERE Type__C =: theType
LIMIT 1 ];
theData.option = anotherobj.option_c;
return theData;
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 get some
Data. What is wrong?
Answer: The member's Name and option of the class MyDataWrapper should be annotated with
@AuraEnabled also.
Question: Which scenario requires a developer to use an Apex callout instead of Outbound
Messaging?
Question: 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?
Answer: Cast each object into an sObject and use sobject.get('Name') to compare the Name fields.
Question: Which use case can be performed only by using asynchronous Apex?
Question: 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?
Answer: SELECT Id FROM Contact WHERE ID NOT IN (SELECT Contact__c FROM Order__c
WHERE
status_c =’Fulfilled’)
Question: A developer wants to integrate invoice and invoice line data into Salesforce from a custom
billing system. The developer decides to make real-time callouts from the billing system using the
SOAP API. Unfortunately, the developer is getting a lot of errors when inserting the invoice line data
because the invoice header record does not exist yet.
Answer: Create the invoice header and the related invoice lines in the same create() call leveraging
External Ids.
Question: A company has a custom object, Order_c, that has a required, unique external ID field
called Order_Number__c.
Which statement should be used to perform the DML necessary to insert new records and update
existing records in a list of Order_c records using the external ID field?
Question: What are three reasons that a developer should write Jest tests for Lightning web
components? Choose 3 answers
Question: 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.
Question: What are three benefits of using static resources in Visualforce and Aura components?
Choose 3 answers
Answer:
Static resource files can be referenced by using the @Resource global variable instead of
hardcoded IDs.
Static resource files can be packaged into a collection of related files in a zip or jar archive.
Relative paths can be used in files in static resource archives to refer to other content
within the archive.
Question: Salesforce users consistently receive a "Maximum trigger depth exceeded" error when
saving an Account.
Question: 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 search Complete 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?
evt.fire();
Question: 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 attempt to deploy this trigger via a change set into the
production environment, but the test class fails with an insufficient privileges error.
Answer: Add system.runast() to the test class to execute the trigger as a user with the correct object
permissions.
Question: Given a list of Opportunity records named opportunity List, which code snippet is best for
querying all Contacts of the Opportunity's Account?
Answer:
accountIds.add(o.AccountId);
for (Account a: [SELECT id, (SELECT ID FROM Contacts) FROM Account WHERE ID IN :
accountIds]){
contactList.addAll(a.Contacts):
}
Question: A developer wishes to improve runtime performance of Apex calls by caching results on the
client.
<template>
<c-my-child-component></ c-my-child-component>
</template>
What is the correct way to communicate the new value of a property named "passthrough to my-
parent-component if the property is defined within my-child-component?
this.dispatchEvent (cEvent);
Question:
@isTest
insert acct;
extension.inputValue = 'test;
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?
Answer:
Question: Part of a custom Lightning Component displays the total number of Opportunities in the org,
which is in the millions. The Lightning Component uses an Apex Controller 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?
Answer: COUNT() SOQL aggregate query on the Opportunity object
Question:
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.
Answer: Use Custom Labels to ensure custom messages are translated properly.
Question: A company wants to implement a new call center process for handling customer service
calls. The new business process requires Service Representatives to ask the calling customer for
their account number before proceeding with the rest of the call script.
Question: How should a developer assert that a trigger with an asynchronous process has
successfully run?
Answer: Create all test data in the test class, invoke Test.startTest) and Test.stopTest() and then
perform assertions.
Question: Universal Containers needs to integrate with a Heroku service that resizes product images
submitted by users.
What are two alternatives to implement the integration and protect against malicious calls to the
Heroku app's endpoint?
Choose 2 answers
Answer: Create a trigger that uses an @future Apex HTTP callout passing JSON serialized data and
some form of pre-shared secret key, so that the Heroku app can authenticate requests and store the
resized images in Salesforce.
Create a workflow rule with an outbound message and select Send Session ID so that the Heroku
app can use it to send the resized images back to Salesforce.
Question: 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.
Answer: Use the standard Account List controller and implement pagination
Question: A developer is building a Lightning web component to get data from an Apex method called
getData that takes a parameter, name. The data should be retrieved when the user clicks the Load
Data button.
account;
name;
nameChanged (evt) {
loadData() {}
Answer: Add getDataname({ this.name}). then (result => this.account = result; }); to the loadData()
function.
Question: A developer wants to call an Apex server-side controller from an Aura component.
What are two limitations to the data being returned by the controller? Choose 2 answers
Answer: Basic data types are supported, but defaults, such as maximum size for a number, are
defined by the objects that they map to.
A custom Apex class can be returned, but only the values of public instance properties and method
annotated with Aura Enabled are serialized and returned.
Question: Universal Containers uses Big Objects to store almost a billion customer transactions called
Customer_Transaction_b.
Account_c
Program_c
Points_Earned_c
Location_c
Transaction_Date__c
The following fields have been identified as Index Fields for the Customer_Transaction_b object:
Account__c, Program__c, and Transaction_Date_c.
Question: The Account edit button must be overridden in an org where a subset of users still use
Salesforce Classic. The org already has a Lightning Component that will do the work necessary for
the override, and the client wants to be able to reuse it.
Answer: Override the edit button for Lightning with a Lightning Component; and for Classic, override
the edit button with a Visualforce page that contains the Lightning Component.
Question: A developer is creating a Lightning web component that can be added to a Lightning App
Page and displayed when the page is rendered in desktop and mobile phone format. To ensure a
great mobile experience, the developer chooses to use the SLDS grid utility.
Which two Lighting web components should the developer implement to ensure the application is
mobile-ready?
Choose 2 answers
Answer: <lightning-layout></lightning-layout>
<lightning-layout-item></lightning-layout-item>
Question: 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.
Answer: An after update trigger that creates the Engineering Review record and inserts it
Question: As part of a custom development, a developer creates a Lightning component to show how
a particular opportunity progresses over time. The component must display the date stamp when any
of the following fields change:
How should the developer access the data that must be displayed?
Answer: Execute a SOQL query for Amount, Probability, Stage, and close Date on the Opportunity
History object
Question: A developer is building a Lightning web component that displays quantity, unit price, and
the total for an order line item. The total is calculated dynamically as the quantity multiplied by the unit
price.
JavaScript:
@api quantity;
@api unitPrice;
Template Markup:
<template>
<div>
</template>
Answer: Add get total() { return quantity * unitPrice; ) to the JavaScript and Total: [total] in the
template
Question: 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?
Question: 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. Also, Workflows that once sent emails and created tasks no longer do so.
Which two statements are true regarding these issues and resolution?
Choose 2 answers
Answer: A sandbox should be created to use as a unified testing environment instead of deploying
Change Sets directly to production
The administrators are deploying their own Change Sets over each other, thus replacing entire Page
Layouts and Workflows in Production.
Question: 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.
Answer: Does the screen need to be rendered as a PDF without using a third-party application
Question: Assuming the CreateOneAccount class creates one account and implements the
Queueable interface, which syntax properly tests the Apex code?
Answer:
List<Account> accts;
Test.startTest();
Test.stopTest();
System.assertEquals( 1, accts.size() );
Question: A developer is inserting, updating, and deleting multiple lists of records in a single
transaction and wants to ensure that any error prevents all execution.
How should the developer implement error exception handling in their code to handle this?
Answer: Use Database. set Savepoint() and Database.rollBack () with a try-catch statement.
Question: 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.
Question: 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.
Question: Universal Containers has an Apex trigger on Account that creates an Account Plan record
when an Account is marked as a customer. Recently a workflow rule 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 workflow rule, two Account Plan records are created whenever the Account
is marked as a customer
Answer: The Apex trigger does not use a static variable to ensure it only fires once.
Question: 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 analyse and diagnose the problem in the Lightning Page?
Question: Which method should be used to convert a Date to a string in the current user's locale?
Answer: Date.format
Question: 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?
Answer: Upsert on the Order_c object and specify the ERP_Customer_ID__c for the Account
relationship.
Question: 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?
Choose 2 answers
Question: @istest
acct.Number_of_Times_Viewed_c = 0;
insert acet;
AuditUtil.incrementViewed (acet.Id);
The test method above 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.
Question: 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.
Question: A developer is developing a reusable Aura component that will reside on an sObject
Lightning page with the following HTML snippet:
<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?
</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.
Component markup:
<aura:component>
<aura:if isTrue=”{!v.showContactInfo}”>
<c:contactInfo value=”{!v.contactInfo}”/>
</aura:if>
</aura:component>
Controller JS:
({
cmp.set("v.showContactinfo", show);
},
// other code...
})
Which change can the developer implement to make the component perform faster?
Choose 2 answers
Answer: An External ID field can be used to reference a unique ID from another, external system
Question: The use of the transient keyword in Visualforce Page Controllers helps with which common
performance issue?
Question: 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
Question: 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.
Answer: Use test. IsRunningTest () before making the callout to bypass it in test execution.
Question: The Contact object in an org is configured with workflow rules that trigger field updates. The
fields are not updating, even though the end user expects them to. The developer creates a debug log
to troubleshoot the problem.
What should the developer specify in the debug log to see the values of the workflow rule conditions
and debug the problem?
Question: 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?
Answer: A Continuation for both the billing callout and the tax callout
Question: How should a developer verify that a specific Account record is being tested in a test class
for a Visualforce controller?
Answer: Insert the Account in the test class, instantiate the page reference in the test class, then use
System.current Page Reference().getParameters() .put() to set the Account ID.
Question: 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
Call loadscript
Question: 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?
Answer: Use a hierarchy custom setting to skip executing the logic inside the trigger for the user who
loads the data
Question: 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 all workflow rules have fired.
Question: A company notices that their unit tests in a test class with many methods to create many
records for prerequisite reference data are slow.
Answer: Move the prerequisite reference data setup to a TestDataFactory and call that from each test
method.
Question: Consider the Apex controller below, that is called from an Aura component.
Line 4
Line 9 }
Line 10 }
Question: A company decides that every time an opportunity is created, they want to create a follow
up Task and assign it to the Opportunity owner.
Question: 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.
Answer: An Apex trigger that creates Apex managed sharing records based on the junction object's
relationships
Question: 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?
Question: 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 will be stored in a custom object for ease of maintenance by
users. Note that the Survey_Response__c object is populated via a custom Visualforce page.
What is the optimal way to implement this?
Answer: Implement the logic in a helper class that is called by an Apex trigger on Contact and from
the Custom Visualforce page controller
Question: 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.
Answer: Create an Apex trigger, execute a Queueable job from it, and make a callout from the
Queueable job.
Question: A Visualforce page loads slowly due to the large amount of data it displays.
Answer: Use lazy loading to load the data on demand, instead of in the controller's constructor.
Question: A lead developer for a Salesforce organization needs to develop a page-centric application
that allows the user to interact with multiple objects related to a Contact. The application needs to
implement a third-party JavaScript framework such as Angular, and must be made available in both
Classic and Lightning Experience.
Given these requirements, what is the recommended solution to develop the application?
Answer: Visualforce
Question: A developer is writing code that requires making callouts to an external web service.
Question: 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.
Savepoint sp = Database.setSavepoint();
Try {
insert regs.values();
insert reglines.values();
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.
Question: What is the best practice to initialize a Visualforce page in a test class?
Question: A page throws an 'Attempt to dereference a null object' error for a Contact
Question: @istest
insert acct;
System.assert(true, acctAfter.Integration_Updated__c);
The test method above calls a web service that updates an external system with Account information
and sets the Account's Integration_Updated__c checkbox to True when it completes. The test fails to
execute and exits with an error: "Methods defined as TestMethod do not support Web service
callouts."
Question: 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.
MyOpportunities.js
@api userid;
opportunities;
Opportunity Controller.cls
@AuraEnabled
return [
SELECT id, Name, Amount FROM Opportunity WHERE OwnerId = : oppOwner WITH
SECURITY_ENFORCED LIMIT 10];
A developer is experiencing issues with a Lightning web component. The component must surface
information about Opportunities owned by the currently logged-in user.
When the component is rendered, the following message is displayed: "Error retrieving data".
Which modification should be implemented to the Apex class to overcome the issue?
Question: An Aura component has a section that displays some information about an Account and it
works well on the desktop, but users have to scroll horizontally to see the description field output on
their mobile devices and tablets.
<lightning:layout multiplerows=”false”>
<lightning:layoutItem size=”6”>{!v.rec.Name}
</lightning:layoutItem>
<lightning:layoutItem size=”6”>{!v.rec.Description__c}
</lightning:layoutItem>
</lightning:layout>
How should a developer change the component to be responsive for mobile and tablet devices?
</lightning:layoutItem>
</lightning:layoutItem>
</lightning:layout>
Answer: Allows for classes to be generated from WSDL and imported into Salesforce
Question: