Question 126

A Next Best Action strategy uses an Enhance Element that invokes an Apex method to determine a discount level for a Contact, based on a number of factors. What is the correct definition of the Apex method?
  • Question 127

    A developer must modify the following code snippet to prevent the number of SOQL queries issued from exceeding the platform governor limit. public class without sharing OpportunityService( public static List<OpportunityLineItem> getOpportunityProducts(Set<Id> opportunityIds){ List<OpportunitylineItem> oppLineItems = new List<OpportunityLineItem>(); for(Id thisOppId : opportunityIds){ oppLineItems.addAll([Select Id FROM OpportunityLineItems WHERE OpportunityId = :thisOppId)]; } return oppLineItems; } } The above method might be called during a trigger execution via a Lightning component. Which technique should be implemented to avoid reaching the governor limit?
  • Question 128

    When the number of record in a recordset is unknown, which control statement should a developer use to implement a set of code that executes for every record in the recordset, without performing a .size() or .length() method call?
  • Question 129

    A developer created a helper class with a method that can be called from Visualforce pages, web services, triggers, and of even anonymous code. When the method is called from a trigger, the developer needs to execute logic that should notbe executed If the method Is called from anywhere else. How can the developer determine if the code Is executed in a trigger context?
  • Question 130

    A developer has a Visualforce page and custom controller to save Account records. The developer wants to display any validation rule violations to the user.
    How can the developer make sure that validation rule violations are displayed?