Question

Difficulty: HardFlow Resources and Data Manipulation

An administrator needs to build an autolaunched flow that processes a list of active Subscription records associated with an Account when its tier is updated. The flow retrieves the related records into a Record Collection Variable and needs to modify the renewal date field on each record in the collection. Which design pattern should the administrator implement to perform this data manipulation while strictly adhering to Salesforce governor limits?

  1. Use a Loop element to iterate over the collection, update the current loop item's renewal date via an Assignment element, append the updated item to a new Record Collection Variable via a second Assignment element, and place a single Update Records element after the loop.Answer
  2. B
    Use a Loop element to iterate over the collection, set the renewal date on the current loop item using an Assignment element, and place an Update Records element inside the loop to persist changes immediately for each record.
  3. C
    Use a Loop element containing a Get Records element to re-query each Subscription record individually, update the renewal date, and execute an Update Records element before proceeding to the next iteration.
  4. D
    Place an Update Records element directly inside the Loop element referencing the original Record Collection Variable without using any Assignment elements.

Answer

The administrator should iterate through the retrieved collection with a Loop element, update the field values on the current loop record using an Assignment element, add the modified record to a secondary Record Collection Variable using another Assignment element, and execute a single Update Records element on the secondary collection outside of the loop.
The correct pattern follows Salesforce bulkification standards for Flow Builder. Modifying record values in memory via Assignment elements and storing them in a collection variable allows all database updates to be committed using a single Update Records DML operation after the loop finishes executing.

Step-by-Step Solution

1
Identify the data manipulation requirement for multiple records in Flow.
Multiple Subscription records must have their renewal date updated in a single transaction.
Flows processing record collections must operate in a bulkified manner to avoid hitting transaction governor limits.
2
Configure the loop iteration and assignment pattern.
Use a Loop element to process each item, modify fields on `$Record` or the current item variable, and append that variable to a target Record Collection Variable (`outputCollection`).
Assignment elements manipulate in-memory flow resources without consuming SOQL or DML transaction limits.
3
Perform DML update outside the loop context.
Connect the 'After Last' path of the Loop element to a single Update Records element pointing to `outputCollection`.
This guarantees that exactly one DML statement is executed regardless of how many records are in the collection.

Key Concept

Flow Bulkification with Assignment Elements and Record Collections
Estimated Time:2m 0s
Rate this question