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?
- 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
- BIterate 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.
- CConfigure 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.
- DCreate 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
Key Concept
Bulkification in Flow Builder using collections, loops, and external DML elements