Question

Difficulty: HardFlow Builder Elements and Logic

A Salesforce Administrator is building an autolaunched flow to process failed Equipment Audit records for a manufacturing facility. When an audit fails, the flow must retrieve all related child Audit Item records, set their status to 'Requires Re-inspection', and increment their internal inspection count by 1. The solution must handle high-volume updates efficiently without hitting transaction governor limits. Which Flow Builder design logic should the administrator implement?

  1. Execute a Get Records element outside the loop, iterate through the retrieved collection, update field values using an Assignment element to append modified records to a new collection variable, and execute a single Update Records element outside the loop.Answer
  2. B
    Iterate through the retrieved collection using a Loop element, and place an Update Records element inside the loop to commit field changes immediately for each Audit Item record.
  3. C
    Create a Roll-Up Summary field on the parent Equipment Audit object linked via a lookup relationship to automatically calculate and push the status change to child Audit Item records.
  4. D
    Use an Assignment element inside the loop to update the status field without assigning the updated picklist value to the Audit Item record type configuration.

Answer

Execute a Get Records element outside the loop, iterate through the retrieved collection, update field values using an Assignment element to append modified records to a new collection variable, and execute a single Update Records element outside the loop.
The correct approach enforces Salesforce bulkification design standards. Using a Get Records element before the loop fetches all necessary records in a single query. Modifying field values with Assignment elements within the loop operates strictly in-memory. Appending updated items to a new record collection variable allows a single Update Records element placed after the loop to perform a bulk DML update, staying well within governor limits.

Step-by-Step Solution

1
Query records outside the loop
Use a single Get Records element to store all target child Audit Item records in a record collection variable.
Prevents issuing multiple SOQL queries inside loop iterations.
2
Iterate and modify using memory operations
Pass the collection into a Loop element. Inside the loop, use an Assignment element to update the field values on the loop current item, then use a second Assignment element to add the current item to a output record collection variable.
Assignment elements perform in-memory variable transformations without invoking database DML transactions.
3
Commit database updates bulkified
Connect the loop exit path to a single Update Records element configured to update the output record collection variable.
Consumes only one DML limit for the entire batch of updated child records.

Key Concept

Flow Bulkification and Logic Elements
Rate this question