Soru

Zorluk: OrtaFlow Resources and Data Manipulation

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?

  1. A
    Place an Update Records element inside a Loop element to immediately save field modifications on each Warehouse Item record during every iteration.
  2. 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.Cevap
  3. C
    Configure 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.
  4. D
    Add a Get Records element inside the Loop element to requery and lock each individual Warehouse Item record before modifying its fields.

Cevap

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.

Adım Adım Çözüm

1
Retrieve related child records into a record collection
A collection variable containing all related Warehouse Item records is created.
A single Get Records element retrieves all target records at once without consuming multiple SOQL queries.
2
Loop through the collection and use an Assignment element to update values and append to a target collection
Field values are modified in memory and appended to a new collection variable.
Data manipulation in memory does not count against database DML governor limits.
3
Execute a single Update Records element using the modified collection variable after the loop path
All updated records are committed to the Salesforce database in one transaction.
Bulkifying the DML operation avoids governor limits and ensures transactional efficiency.

Anahtar Kavram

Bulkification and Collection Management in Flow Builder
Tahmini Süre:1m 15s
Bu soruyu puanla