Soru

Zorluk: OrtaFlow Resources and Data Manipulation

An administrator is designing a flow to update the status of multiple child Inspection Finding records to 'Resolved' whenever a parent Building Inspection record is finalized. The flow must process potentially hundreds of records without hitting Salesforce governor limits. Which two design actions should the administrator take in Flow Builder to manipulate and commit these records efficiently? (Choose two.)

  1. Use an Assignment element inside the loop to add each modified record variable to a new record collection variable.Cevap
  2. B
    Place an Update Records element inside the loop to commit each Inspection Finding status change as it is processed.
  3. Place a single Update Records element after the loop finishes to update the entire record collection variable in a single operation.Cevap
  4. D
    Place a Get Records element inside the loop to re-query and lock each Inspection Finding record before modifying its fields.

Cevap

Use an Assignment element within the loop to populate a record collection variable, and execute a single Update Records element after the loop completes.
To adhere to Salesforce bulkification best practices and avoid hitting governor limits, database operations must never be placed inside loops. Instead, administrators should loop through records, make field modifications in memory using Assignment elements to build a collection variable, and execute a single Update Records DML operation after the loop has finished processing all items.

Adım Adım Çözüm

1
Query records outside the loop
A record collection containing all related child Inspection Finding records is retrieved in a single SOQL query.
All SOQL queries must happen outside of loop iterations to avoid hitting query limits.
2
Iterate and modify records in memory using Assignment elements
Each record's status is modified in memory and appended to a new record collection variable.
Manipulating records in memory consumes CPU time but does not count against database DML limits.
3
Commit the collection update after the loop path completes
All updated child records are saved to the database in a single DML operation.
Bulkifying the DML call ensures the transaction stays well within the 150 DML transaction limit.

Anahtar Kavram

Bulkification in Flow Builder using Record Collection Variables and Assignment Elements
Tahmini Süre:1m 15s
Bu soruyu puanla