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?
Submit