Salesforce PDII Online Practice
Questions and Exam Preparation
PDII Exam Details
Exam Code
:PDII
Exam Name
:Salesforce Certified Platform Developer II (Plat-Dev-301)
Certification
:Salesforce Certifications
Vendor
:Salesforce
Total Questions
:445 Q&As
Last Updated
:Jun 19, 2026
Salesforce PDII Online Questions &
Answers
Question 171:
Salesforce users consistently receive a "Maximum trigger depth exceeded" error when saving m Account. How can a developer fix this error?
A. Split the trigger logic into two separate triggers. B. Modify the trigger to use the isMultiThread=true annotation. C. Convert trigger to use the uture annotation, and chain any subsequent trigger invocations to the Account object. D. Use a helper class to set a Boolean to TRUE the first time a trigger is fired, and then; modify the trigger to only fire when modify the trigger to only fire when the Boolean is FALSE.
D. Use a helper class to set a Boolean to TRUE the first time a trigger is fired, and then; modify the trigger to only fire when modify the trigger to only fire when the Boolean is FALSE.
Explanation
The "Maximum trigger depth exceeded" error occurs when a recursive loop is created, causing triggers to fire repeatedly until the platform's limit of 16 recursive calls is reached. This often happens when an after update trigger performs a DML operation on the same record that initiated the trigger, or when two different objects have triggers that update each other in a circular fashion.
To resolve this, developers use a static Boolean variable within a helper class to manage the execution state. Because static variables in Apex persist for the duration of a single transaction, the trigger can check the value of this Boolean before executing its logic. When the trigger runs for the first time, it checks if the Boolean is FALSE, sets it to TRUE, and then proceeds. If the trigger is re-invoked within the same transaction (recursion), the Boolean check will fail, and the logic will be skipped. This "recursion guard" ensures the logic only runs once per transaction.
Splitting the logic into two triggers (Option A) would not help, as both triggers would still be part of the same recursive cycle. There is no isMultiThread annotation (Option B), and while @future (Option C) can break the immediate execution chain, it does not address the underlying logic flaw and can lead to unmanageable asynchronous overhead. The static variable approach is the industry-standard "best practice" for recursion control.
Question 172:
A developer i$ tasked Dy Unversai Containers to build out a system to track the container repair process. Containers should be tracked as they move through the repair process, starting when a customer reports an issue and ending when the container is returned to the customer.
Which solution meets these business requirements while following best practices?
A. Use Flow Builder|.to develop a Sites page for customers to submit repair requests and track the status of their request. B. involve a Salesforce administrator and build out a declarative solution that works in Salesforce desktop and mobile. C. Build an automated Lightning Application using Application Events to ensure data integrity. D. Use Platform Events with Workflow Rules and RFID integration to ensure proper tracking of the containers.
A. Use Flow Builder|.to develop a Sites page for customers to submit repair requests and track the status of their request.
Question 173:
Users report that a button on a custom Lightning Web Component is not working. However, there are no other details provided. What should the developer use to ensure error messages are properly displayed?
A. Add the <apex:messages/> tag to the component. B. Use the Database method with allOrNone set to false. C. Add a Try/Catch block surrounding the DML statement. D. Add JavaScript and HTML to display an error message.
A. Add the <apex:messages/> tag to the component.
Question 174:
A developer is developing a reuseable Aura Component that will reside on an sObject Lightning Page with the following HTML snippet:
How can the component's Controller get the context of the Lightning Page that the sObject is on without requiring additional test coverage?
A. Use the getSObjectType() method in an Apex class B. Create a design attribute and configure via App builder C. Set the sObject type as a component attribute D. Add force:hasSobjectName to the implements
D. Add force:hasSobjectName to the implements
Question 175:
Which type of controller is best suited when you want all of the basic DML functions from an object's normal new/edit page and want to include multiple records?
A. Standard Controller B. Standard List/Set Controller C. Controller Extensions D. Custom Controller
B. Standard List/Set Controller
Question 176:
Sometimes events on Salesforce need to be handled by an external system due to the scale or type of process being executed. Consider the use case of a user in Salesforce needing to get pricing for an order they are building in Salesforce while on the phone with a customer.
The pricing logic already exists in a third-party system. Instead of recreating this logic in Salesforce, it will be leveraged by making a request of the third-party system. The response, in this case the pricing, will be returned and stored back in Salesforce.
What is the optimal solution?
A. A Visualforce page that can make a real-time Apex callout to display and save the pricing back in Salesforce B. An Apex trigger that upon saving the Order will make a real-time Apex callout, saving the pricing back in Salesforce C. A Process Builder process and Outbound Message to fetch the pricing upon save and store the pricing in Salesforce D. An ETL tool to process batches of newly saved Orders every few minutes to store the pricing back in Salesforce
B. An Apex trigger that upon saving the Order will make a real-time Apex callout, saving the pricing back in Salesforce
Question 177:
The Salesforce admin at Cloud Kicks created a custom object Region__c to store all U.S. postal ZIP codes and the corresponding sales region.
Cloud Kicks wants a trigger on Lead to populate the Lead's Region__c field based on the Lead's PostalCode.
Which code segment is the most efficient way to fulfill this requirement?
A. 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__cFROM Region__cWHERE Zip_Code__c IN :zips];for (Region__c r : regions) {if (l.PostalCode == r.Zip_Code__c) { B. Region__c = r.Region_Name__c;}}} C. 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__cFROM Region__cWHERE Zip_Code__c IN :zips];for (Lead l : Trigger.new) {for (Region__c r : regions) {if (l.PostalCode == r.Zip_Code__c) { D. Region__c = r.Region_Name__c;}}} E. for (Lead l : Trigger.new) {Region__c reg = [SELECT Region_Name__cFROM Region__cWHERE Zip_Code__c = :l.PostalCode]; F. Region__c = reg.Region_Name__c;} G. 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__cFROM Region__cWHERE 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.Region_Name__c);}for (Lead l : Trigger.new) {if (l.PostalCode != null) { H. Region__c = zipMap.get(l.PostalCode);}}
D. Region__c = r.Region_Name__c;}}}
Question 178:
A Salesforce Platform Developer is leading a team that is tasked with deploying a new application to production. The team has used source-driven development, and they want to ensure that the application is deployed successfully.
What tool or mechanism should be used to verify that the deployment is successful?
A. Force.com Migration Tool B. Apex Test Execution C. Salesforce DX CLI D. Salesforce Inspector
C. Salesforce DX CLI
Explanation
In a source-driven development workflow, the "source of truth" is a version control system, and the primary interface for interacting with the Salesforce platform is the Salesforce DX CLI (Option C) .
When a deployment is initiated (using commands like project deploy start or the legacy force:source:deploy), the CLI provides real-time feedback on the status of the deployment. To verify a successful deployment, the CLI returns a detailed summary of the metadata components successfully created or updated, as well as the results of any Apex tests that were required to run as part of the production deployment. If any part of the deployment fails, the CLI provides specific error messages and line numbers, and the entire transaction is rolled back.
Option B (Apex Test Execution) is a component of the verification process, but the CLI is the tool that manages and reports on the overall success. Option A (Migration Tool) is a legacy Ant-based tool that is not the standard for modern source-driven DX projects. Option D is a browser extension for data and metadata inspection but is not a deployment or verification tool. The Salesforce CLI is the backbone of modern CI/CD pipelines and the essential mechanism for verifying deployment integrity.
Question 179:
Account object has a field, Audit_Code__, that is used to specify what type of auditing the Account needs and a Lookup to user, Auditor__ that is the assigned auditor.
When an Account is initially created, the user specifies the Audit_Code__. Each User in the org has a unique text field, that is used to automatically assign the correct user to the Account Auditor__ field.
Trigger:
trigger AccountTrigger on Account (before insert) { AuditAssigner.setAuditor(Trigger.new);
}
Apex Class:
public class AuditAssigner { public static void setAuditor(List<Account> accounts) {
for (User u : [SELECT Id, Audit_Code__c FROM User]) {
for (Account a : accounts) {
if (u.Audit_Code__c == a.Audit_Code__c) {
A. Auditor__c = u.Id;}}}}}What should be changed to most optimize the code's efficiency? B. Build a Map<String, List<Account>> of audit code to accounts. C. Add an initial SOQL query to get all distinct audit codes. D. Add a WHERE clause to the SOQL query to filter On audit codes. E. Build a Map <Id, List<String>> of Account Id to audit codes.
A. Auditor__c = u.Id;}}}}}What should be changed to most optimize the code's efficiency?
Question 180:
Consider the following code snippet:
trigger AccountTrigger on Account (after insert) {
for (Account thisAccount : Trigger.new) { AccountHandler.createRelatedOpportunity(thisAccount);
}
}
public class AccountHandler {
public static void createRelatedOpportunity(Account thisAccount) {
Pricing_Structure__c ps = [ SELECT Type__c FROM Pricing_Structure__c WHERE Industry__c = :thisAccount.Industry LIMIT 1 ];
Opportunity newOpp = new Opportunity( AccountId = thisAccount.Id, Name = thisAccount.Name + ' - Base Opp', CloseDate = System.today().addDays(30), StageName = 'Prospecting', Pricing_Structure__c = ps.Type__c );
insert newOpp;
}
}
Which governor limit is likely to be exceeded when the trigger runs when a scope of 200 newly inserted accounts?
A. Total number of DML statements issued B. Total number of records processed as a result of DML C. Total number of SOQL queries issued D. Total number of SOQL queries issued
Nowadays, the certification exams become more and more important and required by more and more
enterprises when applying for a job. But how to prepare for the exam effectively? How to prepare
for the exam in a short time with less efforts? How to get a ideal result and how to find the
most reliable resources? Here on Vcedump.com, you will find all the answers.
Vcedump.com provide not only Salesforce exam questions,
answers and explanations but also complete assistance on your exam preparation and certification
application. If you are confused on your PDII exam preparations
and Salesforce certification application, do not hesitate to visit our
Vcedump.com to find your solutions here.