Soru

Zorluk: OrtaFlow Builder Elements and Logic

A Salesforce Administrator is creating an after-save record-triggered flow on the Account object to update the mailing address on all child Contact records whenever an Account address changes. To adhere to Salesforce bulkification design principles and prevent hitting governor limits, in which sequence should the administrator execute the flow steps?

  1. 1Execute a Get Records element to query all Contact records where AccountId equals the triggering Account ID.
  2. 2Pass the retrieved Contact collection into a Loop element to process each Contact record individually.
  3. 3Use an Assignment element inside the loop to set the new address values on the current loop Contact item.
  4. 4Use a second Assignment element inside the loop to add the current loop Contact item to a new Contact Record Collection variable.
  5. 5Execute an Update Records element outside the loop, passing the new Contact Record Collection variable.

Cevap

The correct bulkified execution sequence is: 1) Query child Contact records using Get Records, 2) Iterate over the collection with a Loop element, 3) Update field values on the current record using an Assignment element inside the loop, 4) Add the updated record to a target collection variable using a second Assignment element inside the loop, and 5) Execute an Update Records element on the target collection outside of the loop.
The standard bulkification design pattern in Salesforce Flow Builder requires retrieving records once using Get Records, iterating through the collection with a Loop, updating fields on the current item in an Assignment, appending that item to an update collection in a second Assignment, and executing a single Update Records DML operation on the collection after the loop completes.

Adım Adım Çözüm

1
Retrieve related child records using a Get Records element outside any loop structure.
Obtains a Record Collection containing all target Contact records.
Data queries must be executed outside loops to conserve SOQL query limits.
2
Initialize a Loop element to iterate through the retrieved Contact Record Collection.
Sets the current iteration item for step-by-step modification.
Looping allows row-by-row field value updates in memory.
3
Add an Assignment element inside the loop to modify field values on the current iteration item.
Populates updated address values on the loop item variable.
Memory modifications on loop variables do not consume DML governor limits.
4
Add a secondary Assignment element inside the loop to append the current loop item to a dedicated Update Collection variable.
Gathers all updated records into a single collection payload.
A separate collection variable is required to perform a single batch update after iteration ends.
5
Place an Update Records element after the loop path completes, targeting the Update Collection variable.
Executes one DML update statement for all modified Contact records.
Placing DML elements outside of loops prevents governor limit violations such as Too Many DML Statements.

Anahtar Kavram

Flow Bulkification Pattern (SOQL/DML outside Loops)
Bu soruyu puanla