Salesforce PDII Salesforce Certified Platform Developer II Online Training
Salesforce PDII Online Training
The questions for PDII were last updated at Jan 07,2026.
- Exam Code: PDII
- Exam Name: Salesforce Certified Platform Developer II
- Certification Provider: Salesforce
- Latest update: Jan 07,2026
Which two best practices should the developer Implement to optimize this code?
Choose 2 answers
- A . Use a collection for the DML statement.
- B . Query the Pricing_structure__c records outside of the loop.
- C . Change the trigger context to after update, after insert.
- D . Remove the DML statement.
The test method above tests an Apex trigger that the developer knows will make a lot of queries when a lot of Account are simultaneously updated to be customer.
The test method fails at the Line 20 because of too many SOQL queries


What is the correct way to fix this?
- A . Add TesLstartTest() before and Test.stop Test() after both Line 7 of the code and Line 20 of the code.
- B . Change the DataFactory class to create fewer Accounts so that the number of queries in the trigger is reduced.
- C . Add TeststartTest() before Line 18 of the code and add Test.stopTest() after line 18 of the code.
- D . Replace most of the Apex Trigger with Process Builder processes to reduce the number of queries in the trigger.
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.

![]()
What should be done to address the problem?
- A . Move the CalloutUtil.makeRestCallout method call below the catch block.
- B . Remove the Database.setSavepoint and Database.rollback.
- C . Change the CalloutUtil.makeRastCallout to an @InvocableMethed method.
- D . Change the CalloutUtil.makeRestCallout to an @future method.
A developer has a Batch Apex process, Batch_Account_Sales, that updates the sales amount for 10,000 Accounts on a nightly basis. The Batch Apex works as designed In the sandbox. However, the developer cannot get code coverage on the Batch Apex class.
The test class is below:

What is causing the code coverage problem?
- A . The batch process will not recognize new accounts created in the same session
- B . The account creation already sets the sates amount to 0.
- C . The execute Batch must fail within test. startTest ( ) and C test. stopTest().
- D . The batch needs more than one account record created.
Which technique can run custom logic when a Lightning web component is loaded?
- A . Call SA.enqueueAction and pass in the method to call.
- B . Use the renderedCallback () method.
- C . Use an <aura:handler> init event to call a function.
- D . Use the connected-allbacM) method.
The Account object has a field, auais_Code__c, that is used to specify what type of auditing the Account needs and a Lookup to User, Ruditor_c, that is the assigned auditor.
When an Account is initially created, the user specifies the Audit_Code__c. Each User in the org has a unique text field, Rudi. that is used to automatically assign the correct user to the Account’s Auditor__c field.

What should be changed to most optimize the code’s effidency? Choose 2 answers
- A . Build a Mep<String, list<Account>> of audit code to accounts,
- B . Add an initial SOQL query to get all distinct audit codes.
- C . Sulld eMepcié, List<String> of Account I¢ to aucit codes.
- D . Add a WHERE clause to the SOQL query to filter on audit codes.
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?
- A . Use System.profllels() to test as an administrator and a community user,
- B . Use System.profilels() to test as a sales rep and a community user.
- C . Use System.runAs() to test as a sales rep and a community user.
- D . Use System.runAs() to test as an administrator and a community user.
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 attempts to deploy this trigger via a change set into the production environment, but the test class fails with an insufficient privileges error.
What should a developer do to fix the problem?
- A . Add system.runAd ( ) to the best class to execute the trigger as a user with the correct object permissions.
- B . Configure the production environment to enable ‘’Run All tests as Admin User.’’
- C . Verify that Test, statement ( ) is not inside a For loop in the test class.
- D . Add seeAllData=true to the test class to work within the sharing model for the production environment.
A developer created the code to perform an HTP GET request to an external system.

When the code is executed, the callout is unsuccessful and the following error appears within the Developer Console:System.CalloutException: Unauthorized endpoint
Which recommended approach should the developer implement to the callout exception?
- A . create a remote site setting configuration that includes the endpoint.
- B . Annotate the getERPCatalogContents method With @Future (Callout-true)
- C . use the setHeader () method to specify Basic Authentication.
- D . Change the access modifier for ERPCatelog from Public to global
As part of a custom interface, a developer team creates various new Lightning web components. Each of the components handles error* using toast messages. When the development is complete, all the components are added to the same Lightning page.
During acceptance testing, users complain about the long chain of toast messages that display when errors occur loading the component
Which two techniques should the developer Implement to improve the user experience? Choose 2 answers
- A . Use a <template> tag to display in-place error messages.
- B . Use a Lightning web component to aggregate and display all errors.
- C . Use the window. Alert () method to display the error messages.
- D . Use public properties on each component to display the error messages.