An administrator needs to build a Flow that updates the 'Inventory Status' field to 'Allocated' on multiple related Warehouse Item records whenever a Distribution Order is approved. Which design approach should the administrator implement to update all child records efficiently without exceeding Salesforce governor limits?
- APlace an Update Records element inside a Loop element to immediately save field modifications on each Warehouse Item record during every iteration.
- Iterate through the Warehouse Item records in a Loop element, update the loop item values, add each item to a new record collection variable using an Assignment element, and execute a single Update Records element after the loop finishes.Answer
- CConfigure a before-save (fast field update) record-triggered flow on Distribution Order to directly execute DML update statements on the related child Warehouse Item records.
- DAdd a Get Records element inside the Loop element to requery and lock each individual Warehouse Item record before modifying its fields.
Answer
Iterate through the records using a Loop element, modify field values and append each record variable to a new record collection variable using an Assignment element inside the loop, and then perform a single Update Records operation after the loop exits.
Salesforce governor limits require flow bulkification when handling multiple related records. By iterating through retrieved records, modifying the record variable, appending the modified record to a separate collection variable with an Assignment element, and placing the Update Records element outside the loop, all changes are processed using exactly one DML statement.
Step-by-Step Solution
Key Concept
Bulkification and Collection Management in Flow Builder
Estimated Time:1m 15s