Soru

Zorluk: OrtaFlow Builder Elements and Logic

An administrator needs to build a record-triggered flow that updates a custom field on all child Opportunity Line Items when an Opportunity reaches the Closed Won stage. To adhere to Salesforce bulkification best practices and avoid exceeding governor limits, in which sequence should the Flow Builder elements be executed?

  1. 1Get Records element to retrieve all Opportunity Line Item records related to the triggering Opportunity ID.
  2. 2Loop element to iterate through the retrieved collection of Opportunity Line Item records.
  3. 3Assignment element inside the loop to set the values for the updated fields on the current loop item.
  4. 4Assignment element inside the loop to add the current loop item to a new Record Collection variable.
  5. 5Update Records element placed outside the loop to update the Record Collection variable.

Cevap

The correct execution order is: 1) Get Records element to retrieve related child records, 2) Loop element to iterate through the collection, 3) Assignment element inside the loop to set field values on the current item, 4) Assignment element inside the loop to add the current item to a separate collection variable, and 5) Update Records element placed outside the loop to execute the bulk update.
Following the standard bulkification pattern in Flow Builder requires obtaining records into a collection, iterating through them with a loop, assigning modified values to the current loop item in memory, adding that item to a new collection, and performing a single Update Records DML action outside the loop once all iterations complete.

Adım Adım Çözüm

1
Retrieve related records
Obtain a Record Collection containing all child Opportunity Line Items associated with the parent record.
Flows must query child records using a Get Records element before any iteration or field modification can take place.
2
Initiate collection loop
Begin iterating over each individual item in the collection variable.
Looping allows the flow logic to evaluate and update individual fields on each item in the collection.
3
Assign updated field values
Modify field values on the Current Item from the Loop.
Field changes must be assigned in memory to the current loop variable before adding it to an update list.
4
Stage record into update collection
Append the modified current loop item into a designated update record collection.
Staging records into a single collection variable allows all changes to be committed together after iteration finishes.
5
Perform bulk DML update
Execute the Update Records element using the update collection variable outside the loop path.
Placing DML elements outside the loop ensures the flow adheres to governor limits by issuing only a single DML operation.

Anahtar Kavram

Flow Builder Bulkification and Element Sequencing
Bu soruyu puanla