PDII Practice Test Questions

193 Questions


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





C.
  Lightning Component

Explanation:

Since the requirement is to:

Replace the standard Case creation screen
Guide the user through a step-by-step wizard before creating the Case

Work only in Lightning Experience

The most appropriate solution is to use a Lightning Flow (also known as Screen Flow). Salesforce Flows are ideal for building guided, multi-step wizards with minimal code, and they can be used to create or update records — like a Case.

Why Lightning Flow is best:

Allows screen-based, multi-step logic
Can be configured to override standard actions (e.g., "New" button for Case)
Easily customizable and user-friendly
Supports record creation, conditional logic, lookups, and more

Why other options are not the best fit:

A. Lightning Page
This refers to a layout, not an interactive wizard or record creation interface.

B. Lightning Record Page
Also a layout definition; does not provide wizard-like behavior or override "New" action logic.

C. Lightning Component
You could build a wizard using a custom Lightning component, but it would require significant custom code. Salesforce Flow is a declarative alternative, much easier to maintain.

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


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


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


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





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

Explanation:

When writing Apex test classes in Salesforce, @testSetup is a special annotation used to create test data once and reuse it across multiple test methods in the same class. This dramatically reduces the overall execution time, especially when many test methods need the same base data.

Without @testSetup, each test method would have to create the same records repeatedly, which is inefficient and slow. With @testSetup, the platform automatically runs this method once before any test method runs, and all the test methods get access to the same data context.

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 to do address the issue?


A. Turn off triggers, flows, and validations when running tests.


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 a @testSetup method in the test class.


D. Move the prerequisite reference data setup to the constructor for the test class.





C.
  Move the prerequisite reference data setup to a @testSetup method in the test class.

Explanation:

Why Option C is Correct?

@testSetup optimizes test performance by creating test data once before all test methods execute.
This avoids redundant DML operations in every test method, significantly improving speed.
The data is automatically rolled back after each test, ensuring isolation.
This is Salesforce's recommended best practice for shared test data setup.

A developer created a JavaScript library that simplifies the development of repetitive tasks and features and uploaded the library as a static resource called rsutils 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/rescurceUr1/jaUtiles’;


B. const jsUtilivy = SA.get{'SResource.isUtils');


C. impore {jsUtilities} from ‘@salasforce/resourceUrl/jsUtils’;





A.
  import jsUtilities from ‘@salesforce/rescurceUr1/jaUtiles’;

Explanation:

When you upload a JavaScript file as a static resource in Salesforce (in this case, named rsutils), and you want to use it inside a Lightning Web Component (LWC), you must:

Import the static resource URL using the @salesforce/resourceUrl scoped module.
Load it dynamically using the loadScript() function from the lightning/platformResourceLoader module (for JS files).

The correct way to import the static resource’s URL is:

import rsutils from '@salesforce/resourceUrl/rsutils';

Note: You then use loadScript(this, rsutils) inside the component’s lifecycle hook (e.g., connectedCallback() or renderedCallback()).

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

Which two queries are optimized for large data volumes?

Choose 2 answers


A. SELECT I4 FROM Account WHERE Name !— NULL


B. SELECT 1d FROM Accounts WHERE Name != '° AND Customer_Number_c- "ValueA’


C. SELECT ID FROM Account WHRE id IN :aListVariable


D. SELECT Id FROM Account WHERE Name != ‘ ‘AND IsDeleted = false





C.
  SELECT ID FROM Account WHRE id IN :aListVariable

D.
  SELECT Id FROM Account WHERE Name != ‘ ‘AND IsDeleted = false

Explanation:

Why These Queries Are Optimized for LDV?

Option C: SELECT Id FROM Account WHERE Id IN :aListVariable
Uses an indexed field (Id) – Salesforce automatically indexes Id, making this query highly efficient.
Uses a bind variable (:aListVariable) – Limits the records fetched, reducing query time.
Best for selective filtering – Works well even with 200,000+ records because it avoids full table scans.

Option D: SELECT Id FROM Account WHERE Name != ' ' AND IsDeleted = false
Filters on IsDeleted = false – Excludes soft-deleted records (Recycle Bin), reducing the dataset.
Uses Name != ' ' (non-empty filter) – Works efficiently if Name is indexed (standard fields often are).
Avoids unnecessary fields – Only retrieves Id, minimizing data transfer.

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 8 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 object


B. Custom metadata


C. Hierarchy custom setting


D. List custom setting





B.
  Custom metadata

Explanation:

Custom Metadata Types are the best option in this scenario because they:

Allow deployment of configuration settings (like endpoint URLs, API keys, authentication tokens, etc.) across orgs.
Can be easily modified by administrators via the Setup UI without changing code.
Are packaged and deployable through change sets or metadata API.
Are accessible in Apex without needing SOQL (performance advantage).

In the context of storing payment processor settings that:

Need to vary (individual vs. corporate),
Be configurable by admins after deployment, and
Be deployed and updated between environments,

Custom metadata is the most flexible and scalable solution.

Universal Containers is leading a development team that follows the source-driven development approach in Salesforce. As part of their continuous integration and delivery (CL/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. Salesforce CLI with Salesforce DX


B. Salesforce Extensions for Visual Studio Code


C. Change Sets


D. Ant Migration Tool





A.
  Salesforce CLI with Salesforce DX

Explanation:

Salesforce CLI (Command Line Interface) combined with Salesforce DX (Developer Experience) is the cornerstone of source-driven development and modern CI/CD pipelines in Salesforce. It allows teams to:

Automate deployments to any environment (scratch orgs, sandboxes, production).
Integrate with version control systems like Git.
Script and schedule deployments using CI tools like Jenkins, GitHub Actions, or Azure DevOps.
Use unlocked or managed packages for modular, scalable development.

This approach aligns perfectly with Salesforce’s recommended DevOps practices for scalable, repeatable, and testable deployments2.

Why the other options fall short:

B. Salesforce Extensions for Visual Studio Code: Great for local development, but not designed for automation or CI/CD pipelines.

C. Change Sets: Manual, UI-based, and not suitable for source-driven or automated deployments. They lack version control integration and are error-prone at scale.

D. Ant Migration Tool: While scriptable, it’s older and lacks the modern capabilities of Salesforce DX, such as scratch orgs, source tracking, and packaging.

A developer is working on an integration between Salestorce and an external system. The integration requires sending a large amount of data to the external systern, 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.





D.
  Use the @future annotation to make the callout asynchronous.

Explanation:

Why Option D (@future) is the Best Choice?

Asynchronous Processing:

@future decouples the callout from the main transaction, preventing timeouts during long-running operations.
Runs in a separate thread, so the user isn’t blocked.

Governor Limit Friendly:

Avoids synchronous callout limits (e.g., 120-second timeout in Apex).
Allows higher callout limits (up to 120 callouts per future method).

Simple Implementation:

@future(callout=true)
public static void sendDataToExternalSystem(List recordIds) {
// Callout logic here
}

When to Use This?
Large data transfers (e.g., 10K+ records).
External APIs with slow responses.

Universal Containers develops a Visualforce page that requires the inclusion of external JavaScript and C55 files. They want to ensure efficient loading and caching of the page.

Which feature should be utilized to achieve this goal?


A. ActionFunction


B. PageBlockTable


C. Static resources


D. RemoteAction





C.
  Static resources

Explanation:

To efficiently include external JavaScript and CSS files in a Visualforce page, Static Resources are the best and recommended mechanism in Salesforce.

Static resources allow you to:

Bundle and upload external assets like JavaScript, CSS, images, fonts, etc.
Version and cache these assets efficiently.
Reference them in your Visualforce pages using the URLFOR or $Resource expression.
Avoid inline or hardcoded script links, ensuring better maintainability and performance.

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. Set the setting type on the custom setting to Hierarchy.


D. Replace custom settings with custom metadata.





D.
  Replace custom settings with custom metadata.

Explanation:

When a sandbox is refreshed, custom setting data is not retained—it gets wiped out unless manually re-entered. This often leads to test failures if your Apex code depends on that configuration data being present.

Custom metadata types, on the other hand:

Retain their records across sandbox refreshes because the data is part of the metadata.
Are deployable via change sets or metadata API.
Are accessible in test classes without SeeAllData=true, making them more test-friendly.
Can be referenced in Apex, validation rules, flows, and formulas just like custom settings.

This makes custom metadata the ideal choice for storing configuration data that needs to be consistent across environments and available during automated testing.

A company has a web page that needs to get Account record information, such as name, website, and employee number. The Salesforce record 1D is known to the web page and it uses JavaScript to retrieve the account information.

Which method of integration is optimal?


A. Apex SOAP web service


B. SOAP API


C. Apex REST web service


D. REST API





D.
  REST API

Explanation:

Since the Salesforce record ID is already known and the webpage uses JavaScript to retrieve data, the Salesforce REST API is the optimal choice for the following reasons:

It supports simple HTTP methods (GET, POST, etc.) which are easy to use in JavaScript.
It is lightweight and ideal for web-based integrations.
You can easily retrieve a single record using a simple URL structure:

GET /services/data/vXX.X/sobjects/Account/

This makes REST API perfect for quick, read-only operations like retrieving fields from a known Account record.

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 Transactions tab


B. Salesforce Lightning Inspector Actions tab


C. Salesforce Lightning Inspector Event Log tab


D. Salesforce Lightning Inspector Storage tab





D.
  Salesforce Lightning Inspector Storage tab

Explanation:

The Storage tab in the Salesforce Lightning Inspector is specifically designed to help developers analyze client-side caching behavior in Lightning Components. Since the issue involves stale reference data being cached and not updating properly, this tab allows you to:

Inspect localStorage, sessionStorage, and IndexedDB used by Lightning components.
Identify whether outdated data is being retrieved from the browser cache.
Debug how and when components are storing or retrieving data locally.

This is especially useful when components use caching strategies to improve performance but fail to refresh data when needed.


Page 6 out of 17 Pages
Previous