Soru

Zorluk: OrtaFlow Builder Elements and Logic

A Salesforce Administrator is building an autolaunched flow to automatically update open Opportunities when a partner Account is set to Inactive. To adhere to Salesforce governor limits and bulkification design patterns, in what sequence should the administrator place the Flow elements to update the stage of these Opportunities to 'Closed Lost'?

  1. 1Get Records element: Retrieve all open Opportunity records associated with the target Account IDs.
  2. 2Loop element: Iterate over the retrieved collection of Opportunity records.
  3. 3Assignment element: Update the StageName field on the current loop item and add the updated item to a new Record Collection variable.
  4. 4Update Records element: Update database records using the new Record Collection variable after the loop finishes.

Cevap

The correct sequence for bulkified flow execution is: 1) Get Records to query open Opportunities, 2) Loop to iterate through the retrieved collection, 3) Assignment element inside the loop to modify field values and add records to a new collection variable, and 4) Update Records element placed after the loop to perform a single DML operation.
Following standard bulkification practices, data must first be retrieved via Get Records into a collection. A Loop element then steps through each record while an Assignment element updates field values in memory and collects them into a new collection variable. Finally, an Update Records element executes once on the 'After Last Item' path to commit all record changes in a single transaction.

Adım Adım Çözüm

1
Execute Get Records element outside any loop.
Obtains a Record Collection of all target Opportunity records efficiently with one SOQL query.
Prevents SOQL governor limit errors by avoiding data queries inside iterative steps.
2
Pass the retrieved collection into a Loop element.
Iterates through each Opportunity record sequentially.
Allows field assignment logic to evaluate every individual record in memory.
3
Use an Assignment element within the Loop iteration path.
Sets StageName to 'Closed Lost' and adds the modified record to a secondary collection variable.
Staging modifications in a collection variable keeps all changes in memory during loop execution.
4
Connect the 'After Last Item' path of the Loop to an Update Records element.
Persists all modifications to the database in a single DML operation.
Performing DML outside the loop adheres to Salesforce bulkification best practices.

Anahtar Kavram

Flow Bulkification and Element Sequencing
Tahmini Süre:1m 30s
Bu soruyu puanla