Question

Difficulty: MediumFlow Builder Elements and Logic

A Salesforce Administrator is building an After-Save Record-Triggered Flow on the Account object that executes when an Account's rating changes to 'Hot'. The requirement is to set the Status of all related open Cases to 'Escalated' while adhering to Salesforce governor limits and best practices. Which design pattern should the administrator implement within Flow Builder to accomplish this outcome?

  1. Query related open Cases using a Get Records element into a record collection variable, iterate over the collection with a Loop element using an Assignment element to modify the Status field in memory, and execute a single Update Records element passing the collection variable after the loop finishes.Answer
  2. B
    Iterate through the related Cases inside a Loop element and place an Update Records element directly inside the loop to update each Case record's Status immediately during each iteration.
  3. C
    Configure the flow as a Before-Save Record-Triggered Flow on Account to automatically update the child Case records before the parent Account record is committed to the database.
  4. D
    Create a Roll-Up Summary field on the Account object that directly modifies the Status picklist value on all child Case records whenever the Account rating is updated.

Answer

Query related open Cases into a record collection variable using a Get Records element, loop through the collection to modify the Status field using an Assignment element inside the loop, and perform a single Update Records operation on the collection variable after the loop completes.
The correct pattern uses a Get Records element to gather related records into a collection, iterates over the collection to make field modifications using an Assignment element inside the loop, and then uses a single Update Records element outside the loop to update the entire collection in one DML transaction. This ensures optimal performance and prevents hitting governor limits.

Step-by-Step Solution

1
Retrieve related records into memory using Get Records
A record collection variable containing all open Cases associated with the Account is populated in a single SOQL query.
Bulkifying data retrieval avoids governor limits on database queries.
2
Iterate and modify fields in memory using Loop and Assignment elements
The Status field of each Case record in the collection variable is updated to 'Escalated' without invoking DML statements.
Assignment elements perform in-memory changes without performing database transactions inside the loop.
3
Commit all changes to the database using a single Update Records element after the loop
All updated Case records in the collection are written to Salesforce in a single DML statement.
Executing DML outside the loop ensures the flow consumes only 1 DML statement regardless of how many child records are processed.

Key Concept

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