Summer Certification Sale Limited Time 65% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: pass65

PDII Salesforce Certified Platform Developer II ( Plat-Dev-301 ) Questions and Answers

Questions 4

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?

Options:

A.

DML Operation

B.

ChangeLog

C.

Application Event

D.

Component Event16

Buy Now
Questions 5

The test method calls an @future method that increments a value. The assertion is failing because the value equals 0. What is the optimal way to fix this?

Java

@isTest

static void testIncrement() {

Account acct = new Account(Name = ' Test ' , Number_Of_Times_Viewed__c = 0);

insert acct;

AuditUtil.incrementViewed(acct.Id); // This is the @future method

Account acctAfter = [SELECT Number_Of_Times_Viewed__c FROM Account WHERE Id = :acct.Id][0] ;

System.assertEquals(1, acctAfter.Number_Of_Times_Viewed__c);

}

Options:

A.

Change the assertion to System.assertEquals(0, acctAfter.Number_Of_Times_Viewed__c).

B.

Add Test.startTest() before and Test.stopTest() after insert acct.

C.

Change the initialization to acct.Number_Of_Times_Viewed__c = 1.

D.

Add Test.startTest() before and Test.stopTest() after AuditUtil.incrementViewed.

Buy Now
Questions 6

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?

Options:

A.

Salesforce CLI with Salesforce DX

B.

Change Sets

C.

Salesforce Extensions for Visual Studio Code

D.

Ant Migration Tool

Buy Now
Questions 7

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?

Options:

A.

The callout could take longer than 60 seconds to complete.

B.

The callouts will be made using the REST API.

C.

The callouts will be made in an Apex trigger.

D.

Over 10 callouts will be made in a single transaction.

Buy Now
Questions 8

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

Options:

A.

Apex trigger

B.

Remote action

C.

Flow Builder

D.

Apex invocable method

Buy Now
Questions 9

Universal Containers implements a private sharing model for Convention_Attendee__c. A lookup field Event_Reviewer__c was created. Management wants the event reviewer to automatically gain Read/Write access to every record they are assigned to. What is the best approach?

Options:

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 criteria-based sharing rules on the Convention Attendee custom object to share the records with the Event Reviewers.

D.

Create a criteria-based sharing rule on the Convention Attendee custom object to share the records with a group of Event Reviewers.

Buy Now
Questions 10

A company wants to run different logic based on an Opportunity ' s record type. Which code segment handles this request and follows best practices?

Options:

A.

Java

List < RecordType > recTypes = [SELECT Id, Name FROM RecordType WHERE SobjectType = ' Opportunity ' AND IsActive = True];

Map < String, Id > recTypeMap = new Map < String, Id > ();

for (RecordType rt : recTypes) {

recTypeMap.put(rt.Name, rt.Id);

}

for (Opportunity o : Trigger.new) {

if(o.RecordTypeId == recTypeMap.get( ' New ' )) {

// do some logic Record Type 1 <

B.

Java

for (Opportunity o : Trigger.new) {

if (o.RecordType.Name == ' New ' ) {

// do some logic Record Type 1

}

else if (o.RecordType.Name == ' Renewal ' ) {

// do some logic for Record Type 2

}

}

C.

Java

List < RecordType > recTypes = [SELECT Id, Name FROM RecordType WHERE SobjectType = ' Opportunity ' AND IsActive = True];

Map < String, Id > recTypeMap = new Map < String, Id > ();

for (RecordType rt : recTypes) {

recTypeMap.put(rt.Name, rt.Id);

}

for (Opportunity o : Trigger.new) {

if (recTypeMap.get( ' New ' ) != null & & o.RecordTypeId == recTypeMap.get( ' New ' )) {

<
D.

Java

Id newRecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get( ' New ' ).getRecordTypeId();

Id renewalRecordTypeId = Schema.SObjectType.Opportunity.getRecordTypeInfosByName().get( ' Renewal ' ).getRecordTypeId();

for (Opportunity o : Trigger.new) {

if (o.RecordTypeId == newRecordTypeId) {

// do some logic Record Type 1

}

else if (o.RecordTypeId == renewalRecor

Buy Now
Questions 11

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?

Options:

A.

Set the ' IsVisible ' attribute to ' true ' .

B.

Set the ' IsExposed ' attribute to ' true ' .

C.

Specify the ' target ' to be ' lightning__RecordPage ' .

D.

Specify the ' target ' to be ' lightning__AppPage ' .

Buy Now
Questions 12

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?

Options:

A.

Implement platform events.

B.

Create a future method.

C.

Implement the Queueable interface.12

D.

Expose an Apex class as a web service.34

Buy Now
Questions 13

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

Options:

A.

Use Apex Scheduler to schedul4e each process.56

B.

Use Limits class to stop entire pr7ocess once governor limits are reached.8

C.

Use multip9le @future methods for each process and callout.

D.

Use Queueable Apex to chain the jobs to run sequentially.

Buy Now
Questions 14

An Apex trigger creates a Contract record every time an Opportunity record is marked as Closed and Won. A developer is tasked with preventing Contract records from being created when mass loading historical Opportunities, but the daily users still need the logic to fire. What is the most extendable way to update the Apex trigger to accomplish this?

Options:

A.

Add the Profile ID of the user who loads the data to the trigger.

B.

Add a validation rule to the Contract to prevent creation by the data load user.

C.

Use a hierarchy custom setting to skip executing the logic inside the trigger for the user who loads the data.

D.

Use a list custom setting to disable the trigger for the user who loads the data.

Buy Now
Questions 15

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

Options:

A.

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

B.

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

C.

Set the locale on each record in the SOQL result list.

D.

Use the locale clause in the SOQL query.

Buy Now
Questions 16

public class searchFeature {

public static List < List < object > > searchRecords(string searchquery) {

return [FIND :searchquery IN ALL FIELDS RETURNING Account, Opportunity, Lead];

}

}

// Test Class

@isTest

private class searchFeature_Test {

@TestSetup

private static void makeData() {

//insert opportunities, accounts and lead

}

private static searchRecords_Test() {

List < List < object > > records = searchFeature.searchRecords( ' Test ' );

System.assertNotEquals(records.size(),0);

}

}

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?

Options:

A.

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

B.

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

C.

Implement the without sharing keyword in the searchFeature Apex class.

D.

Implement the setFixedSearchResults method in the test class.

Buy Now
Questions 17

Refer to the component code and requirements below:

HTML

< lightning:layout multipleRows= " true " >

< lightning:layoutItem size= " 12 " > {!v.account.Name} < /lightning:layoutItem >

< lightning:layoutItem size= " 12 " > {!v.account.AccountNumber} < /lightning:layoutItem >

< lightning:layoutItem size= " 12 " > {!v.account.Industry} < /lightning:layoutItem >

< /lightning:layout >

Requirements:

    For mobile devices, the information should display in three rows .

    For desktops and tablets, the information should display in a single row .

Requirement 2 is not displaying as desired. Which option has the correct component code to meet the requirements for desktops an 7 d tablets?

Options:

A.

HTML

< lightning:layout multipleRows= " true " >

< lightning:layoutItem size= " 12 " mediumDeviceSize= " 6 " > {!v.account.Name} < /lightning:layoutItem >

< lightning:layoutItem size= " 12 " mediumDeviceSize= " 6 " > {!v.account.AccountNumber} < /lightning:layoutItem >

< lightning:layoutItem size= " 12 " mediumDeviceSize= " 6 " > {!v.account.Industry} < /lightning:layoutItem >

< /lightning:layout >

B.

< lightning:layout multipleRows= " true " > < /lightning:layout > 1213

C.

1415

HTML

< lightning:layout multipleRows= " true " >

< lightning:layoutItem size= " 12 " largeDeviceSize= " 4 " > {!v.account.Name} < /lightning:layoutItem >

< lightning:layoutItem size= " 12 " largeDeviceSize= " 4 " > {!v.account.AccountNumber} < /lightning:layoutItem >

< lightning:layoutItem size= " 12 " largeDeviceSize= " 4 " > {!v.account.Industry} < /lightning:layoutItem >

< /lightning:layout ><

D.

HTML

< lightning:layout multipleRows= " true " >

< lightning:layoutItem size= " 12 " mediumDeviceSize= " 4 " largeDeviceSize= " 4 " > {!v.account.Name} < /lightning:layoutItem >

< lightning:layoutItem size= " 12 " mediumDeviceSize= " 4 " largeDeviceSize= " 4 " > {!v.account.AccountNumber} < /lightning:layoutItem >

< lightning:layoutItem size= " 12 " mediumDeviceSize= " 4 " largeDeviceSize= " 4 " > {

Buy Now
Questions 18

A developer created a class that implements the Queueable Interface, as follows:

Java

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

Options:

A.

Implement seeAllData=true to ensure the Queueable job is able to run in bulk mode.2

B.

Implement Te3st.isRunningTest() to prevent chaining jobs during test execution.

C.

Ensure the running user of the test class has, at least, the View All permission on the Order object.

D.

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

Buy Now
Questions 19

Refer to the code below:

Lightning Web Component JS file

JavaScript

import {LightningElement} from ' lwc ' ;

import serverEcho from ' @salesforce/apex/SimpleServerSideController.serverEcho ' ;

export default class Helloworld extends LightningElement {

firstName = ' world ' ;

handleClick() {

serverEcho({

firstName: this.firstName

})

.then((result) = > {

alert( ' From server: ' + result);

})

.catch((error) = > {

console.error(error);

});

}

}

Apex Controller

Java

public with sharing class SimpleServerSideController {

@AuraEnabled

public static String serverEcho(sObject firstName) {

String firstNameStr = (String)firstName.get( ' firstName ' );

return ( ' Hello from the server, ' + firstNameStr);

}

}

Given the code above, which two changes need to be made in the Apex Controller for the code to work?

Options:

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.

Remove line 06 from the Apex Controller and instead use firstName in the return on line 07.

D.

Change the method signature to be global static, not public static.

Buy Now
Questions 20

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?

Options:

A.

An Apex trigger that calls an @future method that allows callouts910

B.

A flow that calls an @future method that allows callouts1112

C.

A flow with an outbound message that contains a session ID1314

D.

A platform event that makes a callout to the web application1516

Buy Now
Questions 21

Universal Containers wants to use a Customer Community with Customer Community Plus licenses. UC uses a Private sharing model for External users. 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. Which solution solves these requirements?

Options:

A.

An Apex trigger that creates Apex managed sharing records based on the junction object ' s relationships.

B.

A custom list view on the junction object with filters that will show the proper records based on owner.

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.

Buy Now
Questions 22

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?

Options:

A.

Named Credentials

B.

Connected Apps

C.

Remote Site Settings

D.

Session Id

Buy Now
Questions 23

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?

Options:

A.

Use setSavePoint() and rollback() with a try-catch block.

B.

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

C.

Use the Database.Insert method with allOrNone set to false.

D.

Use the Database.Delete method if the Contact insertion fails.

Buy Now
Questions 24

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?

Options:

A.

Ensure test classes are using SeeAllData = true.15

B.

Ensure the Apex classes are on the same API version.16

C.

Ensure the sandbox is on the same release as production.17

D.

Ensure that Disable Parallel Apex Testing is unchecked.18

Buy Now
Questions 25

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?

Java

public void updateAndMakeCallout(Map < Id, Request__c > regs, Map < Id, Request_Line__c > regLines) {

Savepoint sp = Database.setSavepoint();

try {

insert regs.values();

insert regLines.values();

HttpResponse response = CalloutUtil.makeRestCallout(regs.keySet(), regLines.keySet());

} catch (Exception e) {

Database.rollback(sp);

}

}

Options:

A.

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

B.

Change the CalloutUtil.makeRestCallout to an @future method.

C.

Remove the Database.setSavepoint and Database.rollback.

D.

Change the CalloutUtil.makeRestCallout to an @InvocableMethod method.

Buy Now
Questions 26

A developer is building a Lightning web component that retrieves data from Salesforce and assigns it to the record property:

JavaScript

import { LightningElement, api, wire } from ' lwc ' ;

import { getRecord } from ' lightning/uiRecordApi ' ;

export default class Record extends LightningElement {

@api fields;

@api recordId;

record;

}

What must be done in the component to get the data from Salesforce?

Options:

A.

Add @api(getRecord, { recordId: ' $recordId ' }) above record.

B.

Add @wire(getRecord, { recordId: ' $recordId ' }) above record.

C.

Add @api(getRecord, { recordId: ' $recordId ' , fields: ' $fields ' }) above record.

D.

Add @wire(getRecord, { recordId: ' $recordId ' , fields: ' $fields ' }) above record.

Buy Now
Questions 27

Which three actions must be completed in a Lightning web component for a JavaScript file in a static resource to be loaded?

Options:

A.

Call loadScript.

B.

Import the static resource.

C.

Import a method from the platformResourceLoader.

D.

Reference the static resource in a < script > tag.

E.

Append the static resource to the DOM.

Buy Now
Questions 28

Which two queries are selective SOQL queries and can be used for a large data set of 200,000 Account records?

Options:

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 != ' '

D.

SELECT Id FROM Account WHERE Name LIKE ' %Partner '

Buy Now
Questions 29

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.

Java

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?

Options:

A.

Move the SOQL query to within an asynchronous process.

B.

Mark the ERP_Number__c field as required.

C.

Mark the ERP_Number__c field as an external ID.

D.

Change the query to use a SOSL statement instead of SOQL.

Buy Now
Questions 30

A developer has business logic in a trigger that flags high-value opportunities. There is a new requirement to also display high value opportunities in a Lightning web component. Which two steps should the developer take to meet these business requirements, and also prevent the business logic that identifies high-value opportunities from being repeated in more than one place?

Options:

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.

Buy Now
Questions 31

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

Options:

A.

The administrators are deploying their own Change Sets, thus deleting each other ' s fields from the objects in production.3839

B.

The admin40istrators are deploying their own Change Sets over each othe41r, thus replacing entire Page Layouts in production.

C.

Page Layouts should never be deployed via Change Sets, as this causes Field-Level Security to be reset and fields to disappear.42

D.

A sandbox should be created to use as a unified testing environment instead of deploying Change Sets directly to produ43ction.

Buy Now
Questions 32

Java

trigger AssignOwnerByRegion on Account ( before insert, before update ) {

List < Account > accountList = new List < Account > ();

for( Account anAccount : trigger.new ) {

Region__c theRegion = [

SELECT Id, Name, Region_Manager__c

FROM Region__c

WHERE Name = :anAccount.Region_Name__c

];

anAccount.OwnerId = theRegion.Region_Manager__c;

accountList.add( anAccount );

}

update accountList;

}

Consider the above trigger. Which two changes should a developer make in this trigger to adhere to best practices? 30

Options:

A.

Remove the last line updating accountList as it is not needed.31

B.

Use a Map accountMap instead of List accountList.32

C.

Use a Map to cache the results of the Region__c query by Id.33

D.

Move the Re34gion__c query to outside the loop.

Buy Now
Questions 33

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?

Options:

A.

Apex managed sharing23

B.

Sharing sets24

C.

Role hierarchy25

D.

Criteria-based sharing rules26

Buy Now
Questions 34

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?

Options:

A.

Static resources

B.

@RemoteAction

C.

< apex:pageBlockTable >

D.

< apex:actionFunction >

Buy Now
Questions 35

Refer to the test method below:

Java

@isTest

static void testAccountUpdate() {

Account acct = new Account(Name = ' Test ' );

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 method 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. " What is the optimal way to fix this?

Options:

A.

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

B.

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

C.

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

D.

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

Buy Now
Questions 36

An Apex trigger creates a Contract record every time an Opportunity is marked as Closed/Won. Historical records need to be loaded, but Contract records should not be created during this mass load. What is the most extendable way to update the Apex trigger to accomplish this?

Options:

A.

Add the Profile ID of the user who loads the data to the trigger.

B.

Add a validation rule to the Contract to prevent creation by the data load user.

C.

Use a list custom setting to disable the trigger for the user who loads the data.

D.

Use a hierarchy custom setting to skip executing the logic inside the trigger for the user who loads the data.

Buy Now
Questions 37

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?

Options:

A.

Create a Before Save Flow, execute a Queueable job from it, and make a callout from the Queueable job.

B.

Create an Apex class, execute a Batch Apex job from it, and make a callout from the Batch Apex job.

C.

Create an Apex trigger, execute a Queueable job from it, and make a callout from the Queueable job.

D.

Create an Apex class, execute a Future method from it, and make a callout from the Future method.

Buy Now
Questions 38

Which code snippet represents the optimal Apex trigger logic for assigning a Lead ' s Region based on its PostalCode, using a custom Region__c object?

Options:

A.

Java

Set < String > zips = new Set < String > ();

for(Lead l : Trigger.new) {

if(l.PostalCode != Null) {

zips.add(l.PostalCode);

}

}

List < Region__c > regions = [SELECT Zip_Code__c, Region_Name__c FROM Region__c WHERE Zip_Code__c IN :zips];

Map < String, String > zipMap = new Map < String, String > ();

for(Region__c r : regions) {

zipMap.put(r.Zip_Code__c, r.Regio

B.

Region__c = zipMap.get(l.PostalCode);

}

}

C.

Java

Set < String > zips = new Set < String > ();

for(Lead l : Trigger.new) {

if(l.PostalCode != Null) {

zips.add(l.PostalCode);

}

}

for (Lead l : Trigger.new) {

List < Region__c > regions = [SELECT Zip_Code__c, Region_Name__c FROM Region__c WHERE Zip_Code__c IN :zips];

for (Region__c r : regions) {

if(l.PostalCode == r.Zip_Code__c) {

D.

Region__c = r.Region_Name__c;

}

}

}

E.

Java

for (Lead l : Trigger.new) {

Region__c reg = [SELECT Region_Name__c FROM Region__c WHERE Zip_Code__c = :l.PostalCode];

F.

Region__c = reg.Region_Name__c;

}

G.

Java

Set < String > zips = new Set < String > ();

for(Lead l : Trigger.new) {

if(l.PostalCode != Null) {

zips.add(l.PostalCode);

}

}

for(Lead l : Trigger.new) {

List < Region__c > regions = [SELECT Zip_Code__c, Region_Name__c FROM Region__c WHERE Zip_Code__c IN :zips];

for(Region__c r : regions) {

if(l.PostalCode == r.Zip_Code__c) {

Buy Now
Questions 39

Which interface needs to be implemented by an Aura component so that it may be displayed in a modal dialog by clicking a button on a Lightning record page?

Options:

A.

lightning:editAction

B.

lightning:quickAction

C.

force:lightningEditAction

D.

force:lightningQuickAction

Buy Now
Questions 40

A Visualforce page loads slowly due to the large amount of data it displays. Which strategy can a developer use to improve the performance?

Options:

A.

Use the transient keyword for the List variables used in the custom controller.

B.

Use lazy loading to load the data on demand, instead of in the controller ' s constructor.

C.

Use JavaScript to move data processing to the browser instead of the controller.

D.

Use an < apex:actionPoller > in the page to load all of the data asynchronously.

Buy Now
Questions 41

A developer created and tested a Visualforce page in their developer sandbox, but now receives reports that users encounter " View State " errors when using it in production. What should the developer ensure to correct these errors?

Options:

A.

Ensure profiles have access to the Visualforce page.

B.

Ensure properties are marked as private.

C.

Ensure variables are marked as transient.12

D.

Ensure queries do not exceed governor limits.34

Buy Now
Questions 42

To avoid duplicating code and improve maintainability, how should Universal Containers implement an API integration for code reuse?

Options:

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.

Store the API integration code as a static resource and reference it in each Apex class.

D.

Include the API integration code directly in each Apex class that requires it.

Buy Now
Questions 43

A developer created an Apex class that updates an Account based on input from a Lightning web component. The update to the Account should only be made if it has not already been registered.

Java

account = [SELECT Id, Is_Registered__c FROM Account WHERE Id = :accountId];

if (!account.Is_Registered__c) {

account.Is_Registered__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?

Options:

A.

Add a try/catch block around the update.

B.

Use upsert instead of update.

C.

Use FOR UPDATE in the SOQL query.

D.

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

Buy Now
Questions 44

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?

Options:

A.

Disable all flows, and then re-enable them one at a time to see which one causes the error.

B.

Set up debug logging for every Sales Rep, then monitor the logs for errors and exceptions.

C.

Run the Apex Test Classes for the Apex trigger to ensure the code still has sufficient code coverage.

D.

Add system.debug() statements to the code and use the Developer Console logs to trace the code.

Buy Now
Questions 45

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?

Options:

A.

Hierarchy custom setting

B.

Custom label

C.

Custom metadata

D.

List custom setting

Buy Now
Questions 46

Universal Containers wants to develop a recruiting app for iOS and Android via the standard Salesforce mobile app. It has a custom user interface design and offline access is not required. What is the recommended approach to develop the app?

Options:

A.

Salesforce SDK

B.

Lightning Web Components

C.

Lightning Experience Builder

D.

Visualforce

Buy Now
Questions 47

Refer to the following code snippet:

Java

public class LeadController {

public static List < Lead > getFetchLeadList(String searchTerm, Decimal aRevenue) {

String safeTerm = ' % ' +searchTerm.escapeSingleQuotes()+ ' % ' ;

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

Options:

A.

Use the WITH SECURITY_ENFORCED clause within the SOQL query.

B.

Implement the with sharing keyword in the class declaration.567

C.

Annotate 8the Apex method with @AuraEnabled(Cacheable=true).

D.

Implement the without sharing keyword in the class declaration.

E.

Annotate the Apex method with @AuraEnabled.

Buy Now
Questions 48

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?

Options:

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.

Use aggregate functions to query for records older than seven years, and then delete the AggregateResult objects.

C.

Perform a SOSL statement to find records older than 7 years, and then delete the entire result set.

D.

Schedule a batch Apex process to run every day that queries and deletes records older than seven years.

Buy Now
Exam Code: PDII
Exam Name: Salesforce Certified Platform Developer II ( Plat-Dev-301 )
Last Update: Jun 5, 2026
Questions: 161

PDF + Testing Engine

$64.99   $185.69

Testing Engine

$49.99   $142.83

PDF (Q&A)

$54.99   $157.11