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 271:
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".
What step should the developer take to resolve this issue?
A. Split the layout to filter records in one Visualforce page and display the list of records in a second page using the same Apex Controller. B. Adjust any code that filters by picklist values since they are not indexed. C. Use a StandardSetController or SOQL LIMIT in the Apex controller to limit the number of records displayed at a time. D. Remove instances of the transient keyword from the Apex controller to avoid the view state error.
C. Use a StandardSetController or SOQL LIMIT in the Apex controller to limit the number of records displayed at a time.
Explanation
The two symptoms described--slow load times and "Maximum view state size limit exceeded"--are both caused by Large Data Volumes (LDV) being handled improperly in the UI. When a user selects a filter that returns thousands of records, the SOQL query takes longer to execute, and the resulting list is stored in the controller's memory. Because Visualforce serializes all non-transient controller variables into a hidden form field (the View State), large lists quickly exceed the 135KB limit .
The correct resolution is to implement Pagination (Option C) . By using the StandardSetController , a developer can easily manage large sets of data by loading only a small subset (e.g., 20 records) into the View State at a time. Users can then navigate through "Pages" of data. Alternatively, adding a LIMIT to the SOQL query prevents the application from attempting to process more data than the platform limits allow.
Option B is incorrect because picklist fields can be indexed by Salesforce Support or if they are part of a custom index. Option D is the opposite of what is neede4d; adding transient reduces the View State. Option A adds unnecessary complexity without addressing the underlying data volume issue. Using a StandardSetController provides a built-5in, effi6cient way to handle large result sets while keeping the View State small and the page responsive.
Question 272:
A software company uses a custom object Defect_c, to track defects in their software, Defect__c has organisation-wide defaults set to private Each Dafect__c has a related list of Reviewer_c records, each with a lookup field to User that is used to indicate that the User will review the Defect_c.
What should be used to give the User on the Reviewer_c record read only access to the Defect_c record on the Reviewer_c record?
A. View All on Defect_c B. Apex managed sharing C. lightning web component D. Criteria based sharing
B. Apex managed sharing
Explanation
In a Private sharing model, access is strictly limited to owners and those granted access through specific sharing mechanisms. Here, the requirement is to grant access based on a User lookup field residing on a child record (Reviewer__c) to the parent record (Defect__c).
Criteria-based sharing rules (Option D) are ineffective here because they can only evaluate fields on the record being shared (Defect__c) and cannot "look down" at values in related child records to determine access. "View All" (Option A) is too broad as it would grant the user access to every defect in the system, violating the private security model.
Apex managed sharing (Option B) is the correct choice. Because the relationship between the assigned reviewer and the defect is dynamic and based on a separate object, a developer can write an Apex trigger on the Reviewer__c object. When a reviewer record is created or updated, the trigger programmatically inserts a record into the Defect__Share table, granting 'Read' access to the User specified in the lookup field. This provides the precision required to ensure that only the designated reviewers can see specific defects, maintaining the integrity of the Private OWD while automating the necessary exceptions.
Question 273:
Universal Containers uses Big Objects to store almost a billion customer transactions called Customer_Transaction__b.
The following fields have been identified as Index Fields for the Customer_Transaction__b object: Account__c, Program__c, and Transaction_Date__c.
Which SOQL query is valid on the Customer_Transaction__b Big Object?
A. SELECT Account__c, Program__c, Transaction_Date__c FROM Customer_Transaction__bWHERE Account__c = '001R000000302D3'AND Program__c ='Shoppers'AND Transaction_Date__c=2019-05-31T00:00Z B. SELECT Account__c, Program__c, Transaction_Date__cFROM Customer_Transaction__b WHERE Account__c = '001R000000302D3'AND Program__c LIKE 'Shop%'AND Transaction_Date__c=2019-05-31T00:00Z C. SELECT Account__c, Program__c, Transaction_Date__c FROM Customer_Transaction__bWHERE Account__c = '001R000000302D3'AND Program__c INCLUDES ('Shoppers', 'Womens')AND Transaction_Date__c=2019-05-31T00:00Z D. SELECT Account__c, Program__c, Transaction_Date__c FROM Customer_Transaction__bWHERE Account__c = '001R000000302D3'AND Program__c EXCLUDES ('Shoppers', 'Womens')AND Transaction_Date__c=2019-05-31T00:00Z
A. SELECT Account__c, Program__c, Transaction_Date__c FROM Customer_Transaction__bWHERE Account__c = '001R000000302D3'AND Program__c ='Shoppers'AND Transaction_Date__c=2019-05-31T00:00Z
Question 274:
Universal Containers (UC) has an CRP system that stores customer information.
When an Account is created in Salesforce, the FRP system's REST endpoint for creating new customers must automatically be called with the Account information, If the call to the ERP system fails, the Account should still be created.
Accounts in UC org are only created, one at a time, by users in the customer on-boarding department.
What should a developer to make the call to the CRP system's REST endpoint7
A. REST call from JavaScript B. Headless Quick Action C. apex Continuation D. call a Queueable from a Trigger
D. call a Queueable from a Trigger
Explanation
According to 1, REST API provides you with programmatic access to your data in Salesforce. You can use REST API to make HTTP requests to Salesforce endpoints and perform operations on your data. However, you also need to authenticate your requests using OAuth endpoints 2.
According to 3, you can use Queueable Apex to schedule batch send the data from Salesforce to another system using REST API. Queueable Apex allows you to run asynchronous jobs that can be chained and monitored. You can call a Queueable class from a trigger to enqueue the job after an Account is created. Therefore, using a Queueable from a Trigger seems to be the best way to make the call to the ERP system's REST endpoint.
Question 275:
When the sales team views an individual customer record, they need to see recent interactions for the customer. These interactions can be sales, orders, phone calls, or Cases. The date range for recent interactions will be different for every customer record type.
How can this be accomplished?
A. Use a Lightning component to query and display interactions based on record type that is passed in using a design: attribute from the Lightning page. B. Use Batch Apex to query for the most recent interactions when the customer view screen is loaded. C. Use a Process Builder to query the most recent interactions and then display them on the customer view. D. Use Lightning Flow to read the customer's record type, and then do a dynamic query for recent interactions and display on the View page.
A. Use a Lightning component to query and display interactions based on record type that is passed in using a design: attribute from the Lightning page.
Question 276:
A Developer wishes to improve runtime performance of Apex calls by caching results on the client. What is the best way to implement this?
A. Decorate the server-side method with @AuraEnabled(cacheable=true). B. Set a cookie in the browser for use upon return to the page. C. Decorate the server-side method with @AuraEnabled(storable=true). D. Call the setStorable() method on the action in the JavaScript client-side code.
D. Call the setStorable() method on the action in the JavaScript client-side code.
Question 277:
An org has a requirement that an Account must always have one and only one Contact listed as Primary. So selecting one Contact will de-select any others. The client wants a checkbox on the Contact called 'Is Primary' to control this feature.
The client also wants to ensure that the last name of every Contact is stored entirely in uppercase characters.
What is the optimal way to implement these requirements?
A. write a single trigger on Contact for both after update and before update and callout to helper classes to handle each set of logic. B. Write an after update trigger on Contact for the Is Primary logic and a separate before update trigger on Contact for the last name logic. C. write an after update trigger on Account for the Is Primary logic and a before update trigger on Contact for the last name logic. D. write a Validation Rule on the Contact for the Is Primary logic and a before update trigger on Contact for the last name logic.
A. write a single trigger on Contact for both after update and before update and callout to helper classes to handle each set of logic.
Explanation
The optimal architectural approach for complex logic on a single object is to use a single trigger per object that delegates responsibilities to a helper class. This requirement involves two distinct types of logic: field manipulation (uppercase names) and cross-record updates (ensuring only one primary contact).
In Salesforce, Before triggers are ideal for updating fields on the record that initiated the trigger, as the changes are saved to the database without an additional DML statement. Therefore, converting the LastName to uppercase should occur in a before update and before insert context. Conversely, the "Is Primary" logic requires updating other records (de-selecting other contacts on the same account). This must happen in an After trigger context to ensure the primary record has been successfully updated and to avoid recursion or conflicts with the initial save.
Option A is the best practice because it follows the "One Trigger Per Object" design pattern. By using a single trigger with multiple context variables (isBefore, isAfter, isUpdate), the developer can cleanly route the "Last Name" logic to a before-save helper and the "Is Primary" cross-record update logic to an after-save helper. This centralized control prevents multiple triggers from firing in an unpredictable order and simplifies maintenance and debugging.
Question 278:
A developer built a Component to be used at the front desk for guests to self-register upon arrival at a kiosk. The developer is now asked to create a Component for the Utility Tray to alert Users whenever a guest has arrived at the front desk.
What should be used?
A. Changelog B. Component Event C. Application Event D. DML Operation
C. Application Event
Explanation
In the Component framework, communication between components is handled via events. When two components need to communicate but do not share a direct parent-child relationship--such as a kiosk registration component on a page and an alert component residing in the global utility tray --an Application Event (Option C) is required.
Application events follow a "publish-subscribe" model. One component fires the event, and any other component in the application that has a handler for that specific event type can listen for and react to it, regardless of where they sit in the component hierarchy. This is distinct from a Component Event (Option B), which is restricted to bubbling up the component containment hierarchy (from child to parent).
While modern implementations might also consider the Lightning Message Service (LMS) for cross- framework communication (between Aura, LWC, and Visualforce), within the specific context of Aura-to- Aura communication for decoupled components like utility bar items, Application Events remain the fundamental architectural solution. DML Operations (Option D) and ChangeLogs (Option A) are database- level concepts and do not provide the real-time, client-side notification capabilities needed for a UI alert system.
Question 279:
A developer is using a third-party JavaScript library to create a custom user interface in Visualforce. The developer needs to use JavaScript to get data from a controller method in response to a user action.
How can the developer accomplish this?
A. Use <apex:actionFunction> to create a JavaScript wrapper for the controller method B. Use the @RemoteAction annotation on the method definition with JavaScript Remoting C. Use the $Controller global variable to access the controller method via JavaScript D. Use <apex:actionSupport> to enable JavaScript support for the controller method
B. Use the @RemoteAction annotation on the method definition with JavaScript Remoting
Question 280:
Universal Containers wants to notify an external system, in the event that an unhandled exception occurs, by publishing a custom event using Apex.
What is the appropriate publish/subscribe logic to meet this requirement?
A. Publish the error event using the EventBus.publish() method and have the external system subscribe to the event using CometD. B. Publish the error event using the addError() method and have the external system subscribe to the event using CometD. C. Publish the error event using the addError() method and write a trigger to subscribe to the event and notify the external system. D. Have the external system subscribe to the event channel. No publishing is necessary.
A. Publish the error event using the EventBus.publish() method and have the external system subscribe to the event using CometD.
Explanation
Platform Events provide a powerful way to integrate Salesforce with external systems using an event-driven architecture. To meet the requirement of notifying an external system about an exception, the developer must first define a Custom Platform Event (e.g., Error_Event__e). In the Apex code, specifically within a catch block, the developer should instantiate this event and publish it using the EventBus.publish() method ( Option A ).
Once published, the event is placed on the event bus. External systems can listen for these events by subscribing to the event channel. The standard protocol for external clients to subscribe to Salesforce Platform Events is CometD , an implementation of the Bayeux protocol that allows for long-polling and real-time push notifications.
Option B and C are incorrect because addError() is a method used in triggers or Visualforce to display a validation error message to the UI and roll back the transaction; it is not used for publishing Platform Events. Option D is incorrect because an external system cannot receive an event unless the Salesforce application explicitly publishes it to the bus. Using EventBus.publish() with a CometD subscriber provides a robust, decoupled integration pattern for real-time error reporting.
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.