Soru

Zorluk: Çok zorFlow Builder Elements and Logic

A Salesforce Administrator needs to build a record-triggered flow on the Opportunity object that aggregates the Grand Total of all open Quote records related to the parent Account and updates a custom field on that Account, adhering strictly to bulkification best practices. Place the following Flow Builder steps in the correct execution order from first to last.

  1. 1Execute a Get Records element to retrieve all Quote records where AccountId equals $Record.AccountId and Status does not equal 'Closed' into a record collection variable.
  2. 2Pass the retrieved Quote record collection into a Loop element to process each record individually.
  3. 3Use an Assignment element within the loop's 'For each item' path to add the current Quote's Grand Total value to a running total variable.
  4. 4Use an Assignment element on the 'After last item' path to assign the accumulated total variable and the Account Id to an Account record variable.
  5. 5Execute a single Update Records element using the prepared Account record variable to commit the updated total to Salesforce.

Cevap

The correct sequence of Flow Builder steps is: First, execute a Get Records element to fetch all relevant Quotes. Second, pass the collection into a Loop element. Third, assign each Quote's Grand Total to a running variable inside the loop. Fourth, set the Account record variable fields using an Assignment element after the loop completes. Finally, execute an Update Records element to commit the changes.
The correct design pattern follows bulkification best practices in Salesforce Flow Builder: initial query via Get Records, iteration over collection elements in a Loop, in-memory calculation using Assignment within the loop path, single record assignment after the loop completes, and a final database update via Update Records outside the loop.

Adım Adım Çözüm

1
Retrieve child Quote records using a Get Records element.
A record collection variable populated with open Quote records linked to the Account.
Data must be retrieved in a single bulkified query before processing.
2
Iterate through the collection with a Loop element.
Each Quote record is assigned to the loop iteration variable sequentially.
Flow Builder requires a loop to inspect individual field values within a record collection.
3
Aggregate values inside the loop using an Assignment element.
The running total variable increments by the Grand Total of each Quote.
In-memory variable manipulation inside a loop avoids governor limit violations.
4
Prepare the parent Account update after the loop finishes using an Assignment element.
The target Account record variable is populated with the Account ID and the total value.
Staging the record update in memory prevents multiple DML executions.
5
Commit changes using an Update Records element.
The parent Account record in the database is updated with the new total.
A single DML operation outside the loop executes efficiently and adheres to limits.

Anahtar Kavram

Flow Bulkification and Element Sequencing
Bu soruyu puanla