An administrator is designing an after-save Record-Triggered Flow on the Opportunity object to recalculate custom pricing tiers across multiple child Opportunity Line Item records when an Opportunity reaches the 'Closed Won' stage. The flow must obtain the child records, filter out items tied to archived product families, update the unit price on eligible items, and commit the changes to the database. To ensure the flow is fully bulkified and performs reliably during mass record updates, which design pattern should the administrator implement?
- Query related Opportunity Line Items into a record collection variable using Get Records, refine the collection with a Collection Filter element, loop through the filtered collection using an Assignment element to modify field values and append each item to a new record collection variable, and execute a single Update Records element on the new collection outside the loop.Cevap
- BQuery related Opportunity Line Items into a record collection variable, iterate through the collection using a Loop element with an embedded Decision element to check product family status, and place an Update Records element inside the loop path to persist each updated record immediately.
- CConfigure the flow to execute before-save on the Opportunity Line Item object, and use a Get Records element inside an Assignment element to query parent Opportunity stage details dynamically before applying the pricing tier.
- DUse a Fast Field Update flow on Opportunity Line Item to perform inline record updates, using a decision matrix within a Loop element that bypasses system validation rules during transaction execution.
Cevap
The administrator should retrieve related child records into a collection, apply filtering using a Collection Filter element, update record values inside a loop by staging updated items into a target collection variable via Assignment elements, and execute a single Update Records element outside the loop.
To process data efficiently and maintain bulkification in Salesforce Flow, all database operations (Get, Create, Update, Delete) must be kept outside of loops. Utilizing a Collection Filter element allows filtering of records in memory. Modifying loop items and adding them to a secondary collection variable enables a single Update Records element at the end of the execution path to update all target records in a single bulkified DML operation.
Adım Adım Çözüm
Anahtar Kavram
Flow Data Bulkification and Collection Management
Tahmini Süre:3m 0s