Question

Difficulty: HardFlow Resources and Data Manipulation

An administrator is designing an autolaunched flow that processes a large collection of Opportunity records associated with an Account to aggregate financial metrics and update parent fields. Which two data manipulation and resource design practices should the administrator implement to ensure the flow executes within Salesforce governor limits? (Select 2 options)

  1. Filter records directly within the Get Records element query criteria rather than retrieving all records and filtering them downstream using a Decision element.Answer
  2. Use an Assignment element inside the loop to accumulate values into a variable, then perform a single Update Records element outside the loop.Answer
  3. C
    Place an Update Records element inside the Loop element to save changes to each Opportunity record individually during each iteration.
  4. D
    Place a Get Records element inside the Loop element to re-query related line items for each Opportunity on every loop iteration.

Answer

The correct practices are to filter records directly within the Get Records element query criteria and to accumulate values in a variable using an Assignment element inside the loop while placing the Update Records element outside the loop.
Filtering criteria directly inside the Get Records element reduces database overhead by retrieving only necessary records. In addition, using Assignment elements inside the loop to build in-memory updates or collections and executing database operations outside the loop ensures the flow is bulkified and compliant with governor limits.

Step-by-Step Solution

1
Evaluate record querying best practices.
Filtering records directly in the Get Records element minimizes SOQL output and memory usage.
Retrieving unfiltered records and evaluating them in memory consumes unnecessary resources and may hit limits.
2
Evaluate loop iterations and DML positioning.
Placing Assignment elements inside the loop to update record variables in memory allows bulkified DML outside the loop.
Executing DML elements inside a loop causes governor limit exceptions.

Key Concept

Flow Bulkification and Resource Management
Rate this question