Soru

Zorluk: OrtaFlow Resources and Data Manipulation

An administrator is building an autolaunched flow that updates the Status field to 'Waitlisted' across all related Conference Registration records whenever a Conference session reaches maximum capacity.

What should the administrator do to update the records efficiently while respecting governor limits?

  1. A
    Iterate through the retrieved registration collection using a Loop element, and place an Update Records element inside the loop to update each record individually.
  2. Iterate through the registration collection with a Loop element, modify the Status in an Assignment element, add each updated record to a second collection variable, and use a single Update Records element after the loop finishes.Cevap
  3. C
    Configure a before-save record-triggered flow on the parent Conference object to directly update the child Conference Registration records before the session record is committed to the database.
  4. D
    Use a single Assignment element directly after the Get Records element to update the Status field across the entire record collection without looping, then rely on system validation rules to commit the changes.

Cevap

Iterate through the retrieved registration records with a Loop element, update the record variable in an Assignment element, add each record to a new collection variable in a second assignment, and execute a single Update Records element after the loop completes.
Salesforce best practice requires bulkifying flow logic. When updating multiple child records, an administrator should loop through the records, modify fields on the loop variable, append each modified record to a separate collection variable using an Assignment element, and execute a single Update Records element after the loop has finished.

Adım Adım Çözüm

1
Retrieve related child records using a Get Records element into a record collection variable.
A collection containing all matching Conference Registration records is stored in memory.
The flow needs the specific set of child records to iterate through and modify.
2
Loop through the collection and use an Assignment element to update the field values on the current loop item.
The current item in the loop has its Status set to 'Waitlisted'.
Flow elements must modify individual record variables sequentially.
3
Add the modified loop record variable to a new record collection variable using an Assignment element with the 'Add' operator.
A staging collection variable gathers all updated records in memory without making database calls.
Collecting all records in memory allows batching the database update into a single transaction.
4
Place an Update Records element on the canvas after the loop path completes and pass the staging collection variable to it.
All modified records are committed to the Salesforce database in a single DML statement.
Executing DML operations outside loops avoids hitting Salesforce transaction governor limits (such as 150 DML statements per transaction).

Anahtar Kavram

Flow bulkification design pattern using Loop, Assignment, and Collection variables
Tahmini Süre:1m 15s
Bu soruyu puanla