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

Salesforce Certified Platform Developer II ( Plat-Dev-301 ) PDII Question # 36 Topic 4 Discussion

Salesforce Certified Platform Developer II ( Plat-Dev-301 ) PDII Question # 36 Topic 4 Discussion

PDII Exam Topic 4 Question 36 Discussion:
Question #: 36
Topic #: 4

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?


A.

Remove the DML statement.


B.

Change the trigger context to after update, after insert.


C.

Query the Pricing_Structure_c records outside of the loop.


D.

Use a collection for the DML statement.


Get Premium PDII Questions

Contribute your Thoughts:


Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.