Free PDII Questions for Salesforce Platform Developer II PDII Exam as PDF & Practice Test Engine
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?
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?
Correct Answer: C
Vote an answer
Explanation: Only visible for ExamDiscuss members. You can sign-up / login (it's free).
A developer is tasked with ensuring that email addresses entered into the system for Contacts and for a custom object called Survey_Response__c do not belong to a list of blocked domains. The list of blocked domains is stored in a custom object for ease of maintenance by users. The Survey_Response__c object is populated via a custom Visualforce page. What is the optimal way to implement this?
Correct Answer: A
Vote an answer
Explanation: Only visible for ExamDiscuss members. You can sign-up / login (it's free).
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?
Correct Answer: C
Vote an answer
Explanation: Only visible for ExamDiscuss members. You can sign-up / login (it's free).
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?
Correct Answer: C
Vote an answer
Explanation: Only visible for ExamDiscuss members. You can sign-up / login (it's free).
Consider the following code snippet:78
Java
trigger OpportunityTrigger on Opportunity (before insert, before update) { for(Opportunity opp : Trigger.new){ OpportunityHandler.setPricingStructure(Opp);
}
}
public class OpportunityHandler{
public static void setPricingStructure(Opportunity thisOpp){
Pricing_Structure_c ps = [Select Type_c FROM Pricing_Structure_c WHERE industry_c = :thisOpp.
Account_Industry_c];
thisOpp.Pricing_Structure_c = ps.Type_c;
update thisOpp;
}
}
Which two best practices should the developer implement to optimize this code?
Java
trigger OpportunityTrigger on Opportunity (before insert, before update) { for(Opportunity opp : Trigger.new){ OpportunityHandler.setPricingStructure(Opp);
}
}
public class OpportunityHandler{
public static void setPricingStructure(Opportunity thisOpp){
Pricing_Structure_c ps = [Select Type_c FROM Pricing_Structure_c WHERE industry_c = :thisOpp.
Account_Industry_c];
thisOpp.Pricing_Structure_c = ps.Type_c;
update thisOpp;
}
}
Which two best practices should the developer implement to optimize this code?
Correct Answer: B,C
Vote an answer
Explanation: Only visible for ExamDiscuss members. You can sign-up / login (it's free).
A developer created a Lightning web component that uses a lightning-record-edit-form to collect information about Leads. Users complain that they only see one error message at a time about their input when trying to save a Lead record. Which best practice should the developer use to perform the validations on more than one field, thus allowing more than one error message to be displayed simultaneously?
Correct Answer: D
Vote an answer
Explanation: Only visible for ExamDiscuss members. You can sign-up / login (it's free).
A developer created a JavaScript library that simplifies the development of repetitive tasks and features and uploaded the library as a static resource called jsUtils 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?
Correct Answer: D
Vote an answer
Explanation: Only visible for ExamDiscuss members. You can sign-up / login (it's free).
A developer is writing a Jest test for a Lightning web component that conditionally displays child components based on a user's checkbox selections. What should the developer do to properly test that the correct components display and hide for each scenario?
Correct Answer: A
Vote an answer
Explanation: Only visible for ExamDiscuss members. You can sign-up / login (it's free).
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?
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?
Correct Answer: C
Vote an answer
Explanation: Only visible for ExamDiscuss members. You can sign-up / login (it's free).
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?
Correct Answer: B,C
Vote an answer
Explanation: Only visible for ExamDiscuss members. You can sign-up / login (it's free).
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?
Correct Answer: D
Vote an answer
Explanation: Only visible for ExamDiscuss members. You can sign-up / login (it's free).
0
0
0
10
