Question

Difficulty: MediumFlow Builder Elements and Logic

A company requires an automated process on the Case object. When a Case status is updated to 'Closed', all associated open Task records must have their status changed to 'Completed'. To maintain system efficiency and prevent reaching governor limits during bulk updates, which design pattern and element structure should be used in Flow Builder?

  1. Retrieve open Tasks with a Get Records element, loop through the collection, update each Task item's fields and add it to a output collection variable using an Assignment element inside the loop, then execute a single Update Records element outside the loop.Answer
  2. B
    Retrieve open Tasks with a Get Records element, loop through the record collection, and place an Update Records element inside the loop to save each Task record immediately upon modification.
  3. C
    Create a Roll-Up Summary field on the Case object to count open Tasks, then use a Decision element to update child Tasks directly without using a collection variable.
  4. D
    Loop through the Task records and use an Assignment element inside the loop to update the available picklist values assigned to the Task record type.

Answer

Retrieve open Tasks using a Get Records element, loop through the collection, update field values and append items to a new collection using an Assignment element inside the loop, and place a single Update Records element outside the loop.
The correct approach uses a Get Records element to retrieve all related open Tasks into a collection, iterates through the collection using a Loop element, uses Assignment elements inside the loop to modify field values in memory and stage them into a output collection, and finally uses a single Update Records element outside the loop to commit all updates to the database in a single transaction.

Step-by-Step Solution

1
Query related records into a collection variable
A Get Records element fetches all open Tasks related to the triggering Case into a record collection.
Bulkifying data retrieval ensures only one SOQL query is executed.
2
Process items in memory using Loop and Assignment elements
For each Task in the loop, set the Status field to 'Completed' and add the current loop item to a new output record collection variable.
In-memory variable manipulation does not consume database governor limits.
3
Persist changes using a single DML operation outside the loop
An Update Records element references the output collection variable after the loop finishes.
Executing DML outside the loop ensures only one database write operation occurs regardless of record count.

Key Concept

Bulkification in Flow Builder using collections, loops, and external DML elements
Rate this question