Month End Sale Limited Time 70% Discount Offer - Ends in 0d 00h 00m 00s - Coupon code: simple70

Pass the Salesforce Developers PDII Questions and answers with CertsForce

Viewing page 3 out of 5 pages
Viewing questions 21-30 out of questions
Questions # 21:

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?

Options:

A.

Force.com Migration Tool


B.

Apex Test Execution


C.

Salesforce DX CLI


D.

Salesforce Inspector


Expert Solution
Questions # 22:

A developer created an Opportunity trigger that updates the account rating when an associated opportunity is considered high value. Current criteria for an opportunity to be considered high value is an amount greater than or equal to $1,000,000. However, this criteria value can change over time. There is a new requirement to also display high value opportunities in a Lightning web component. Which two actions should the developer take to meet these business requirements, and also prevent the business logic that obtains the high value opportunities from being repeated in more than one place?2021

Options:

A.

L22eave the business logic code inside the trigger for efficiency.23


B.

Use custom metadata to hold the high value amount.24


C.

Call the trigger from the Lightning web25 component.


D.

Create a helper class that fetches the high value opportunities.


Expert Solution
Questions # 23:

The test method calls an @future method that increments a value. The assertion is failing because the value equals 0. What is the optimal way to fix this?

Java

@isTest

static void testIncrement() {

Account acct = new Account(Name = 'Test', Number_Of_Times_Viewed__c = 0);

insert acct;

AuditUtil.incrementViewed(acct.Id); // This is the @future method

Account acctAfter = [SELECT Number_Of_Times_Viewed__c FROM Account WHERE Id = :acct.Id][0];

System.assertEquals(1, acctAfter.Number_Of_Times_Viewed__c);

}

Options:

A.

Change the assertion to System.assertEquals(0, acctAfter.Number_Of_Times_Viewed__c).


B.

Add Test.startTest() before and Test.stopTest() after insert acct.


C.

Change the initialization to acct.Number_Of_Times_Viewed__c = 1.


D.

Add Test.startTest() before and Test.stopTest() after AuditUtil.incrementViewed.


Expert Solution
Questions # 24:

An Apex trigger and Apex class increment a counter, `Edit_Count__c`, any time the Case is changed.

```java

public class CaseTriggerHandler {

public static void handle(List cases) {

for (Case c : cases) {

c.Edit_Count__c = c.Edit_Count__c + 1;

}

}

}

trigger on Case(before update) {

CaseTriggerHandler.handle(Trigger.new);

}

```

A new before-save record-triggered flow on the Case object was just created in production for when a Case is created or updated. Since the process was added, there are reports that `Edit_Count__c` is being incremented more than once for Case edits. Which Apex code fixes this problem?

Options:

A.

```java

public class CaseTriggerHandler {

public static Boolean firstRun = true;

public static void handle(List cases) {

for (Case c : cases) {


B.

Edit_Count__c = c.Edit_Count__c + 1;

}

}

}

trigger on Case(before update) {

CaseTriggerHandler.firstRun = true;

if (CaseTriggerHandler.firstRun) {

CaseTriggerHandler.handle(Trigger.newMap);

}

CaseTriggerHandler.firstRun = false;

}

```


C.

```java

public class CaseTriggerHandler {

public static Boolean firstRun = true;

public static void handle(List cases) {

for (Case c : cases) {


D.

Edit_Count__c = c.Edit_Count__c + 1;

}

}

}

trigger on Case(before update) {

if (CaseTriggerHandler.firstRun) {

CaseTriggerHandler.handle(Trigger.new);

}

CaseTriggerHandler.firstRun = false;

}

```


E.

```java

public class CaseTriggerHandler {

Boolean firstRun = true;

public static void handle(List cases) {

if (firstRun) {

for (Case c : cases) {


F.

Edit_Count__c = c.Edit_Count__c + 1;

}

}

firstRun = false;

}

}

trigger on Case(before update) {

CaseTriggerHandler.handle(Trigger.new);

}

```


G.

```java

trigger on Case(before update) {

Boolean firstRun = true;

if (firstRun) {

CaseTriggerHandler.handle(Trigger.newMap);

}

firstRun = false;

}

```


Expert Solution
Questions # 25:

Refer to the code snippet below:

Java

public static void updateCreditMemo(String customerId, Decimal newAmount){

List toUpdate = new List();

for(Credit_Memo__c creditMemo : [Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId LIMIT 50]) {

creditMemo.Amount__c = newAmount;

toUpdate.add(creditMemo);

}

Database.update(toUpdate,false);

}

A custom object called Credit_Memo__c exists in a Salesforce environment. As part of a new feature development, the developer needs to ensure race conditions are prevented when a set of records are mod1ified within an Apex transaction. In the preceding Apex code, how can the developer alter the que2ry statement to use SOQL features to prevent race conditions within a tr3ansaction?4

Options:

A.

[Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId LIMIT 50 FOR UPDATE]


B.

[Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId USING SCOPE LIMIT 50]


C.

[Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId LIMIT 50 FOR REFERENCE]


D.

[Select Id, Name, Amount__c FROM Credit_Memo__c WHERE Customer_Id__c = :customerId LIMIT 50 FOR VIEW]


Expert Solution
Questions # 26:

Part of a custom Lightning component displays the total number of Opportunities in the org, which are in the millions. The Lightning component uses an Apex method to get the data it needs. What is the optimal way for a developer to get the total number of Opportunities for the Lightning component?

Options:

A.

COUNT () SOQL aggregate query on the Opportunity object


B.

Apex batch job that counts the number of Opportunity records


C.

SUM () SOQL aggregate query on the Opportunity object


D.

SOQL for loop that counts the number of Opportunities records


Expert Solution
Questions # 27:

A developer is inserting, updating, and deleting multiple lists of records in a single transaction and wants to ensure that any error prevents all execution. How should the developer implement error exception handling in their code to handle this?1234567

Options:

A.

Use Database methods to obtain lists of Database.SaveResults.


B.

Use Database.setSavepoint() and Database.rollBack() with a try-catch statement.


C.

Use a try-catch statement and handle DML cleanu22p in the catch statement.


D.

Us29e a try-catch and use sObject.addError() on any failures.


Expert Solution
Questions # 28:

Consider the following code snippet:

HTML

<apex:page docType="html-5.0" controller="FindOpportunities">

<apex:form >

<apex:pageBlock >

<apex:pageBlockSection title="find opportunity">

<apex:input label="opportunity name"/>

<apex:commandButton value="search" action="{!search}"/>

</apex:pageBlockSection>

<apex:pageBlockSection title="Opportunity List" id="opportunityList">

</apex:pageBlockSection>

</apex:pageBlock>

</apex:form>

</apex:page>

Users of this Visualforce page complain that the page does a full refresh every time the Search button is pressed. What should the developer do to ensure that a partial refresh is made so that only t13he section identified with opportunityList is re-drawn on the screen?1415

Options:

A.

Enclose the DAT16A table within the <apex:actionRegion> tag.1718


B.

Implement the <apex:actionFunction> tag with immediate = true.


C.

Ensure the action method search returns null.19


D.

Implement the reRender attribute on the <apex:commandButton> tag.


Expert Solution
Questions # 29:

As part of point-to-point integration, a developer must call an external web service which, due to high demand, takes a long time to provide a response. As part of the request, the developer must collect key inputs from the end user before making the callout. Which two elements should the developer use to implement these business requirements?4647

Options:

A.

Batch Apex4849


B.

Lightning web component5051


C.

Screen Flow5253


D.

Apex method that returns a Continuation object5455


Expert Solution
Questions # 30:

A developer is developing a reusable Aura component that will reside on an sObject Lightning page with the following HTML snippet:

HTML

<aura:component implements="force:hasRecordId,flexipage:availableForAllPageTypes">

Hello!

</aura:component>

How can the component's controller get the context of the Lightning page that the sObject is on without requiring additional test coverage?

Options:

A.

Create a design attribute and configure via App Builder.


B.

Set the sObject type as a component attribute.


C.

Use the getSObjectType() method in an Apex class.


D.

Add force:hasSObjectName to the implements attribute.


Expert Solution
Viewing page 3 out of 5 pages
Viewing questions 21-30 out of questions