Question

Difficulty: HardFlow Builder Elements and Logic

A Salesforce Administrator is designing a record-triggered flow on the custom object Contract_Renewal__cContract\_Renewal\_\_c. When a renewal record is marked as 'High Risk', the flow must retrieve all related Contract_Line_Item__cContract\_Line\_Item\_\_c records linked via a lookup relationship, iterate through the retrieved records to sum the total value of active items using a currency variable, and update the triggering Contract_Renewal__cContract\_Renewal\_\_c record with the calculated total. Which element structure and configuration represents the most efficient, governor-limit-safe implementation in Flow Builder?

  1. Place a Decision element inside the Loop to verify if a line item is active, use an Assignment element inside the Loop to add the active item's value to a currency variable, and place an Update Records element outside the Loop to update the triggering contract renewal record.Answer
  2. B
    Place an Update Records element inside the Loop element immediately after a Decision element so each active line item's value is committed to the database on every iteration step.
  3. C
    Create a standard Roll-Up Summary field on the Contract_Renewal__cContract\_Renewal\_\_c object to sum active Contract_Line_Item__cContract\_Line\_Item\_\_c values directly instead of using Flow Builder elements.
  4. D
    Use an Assignment element inside the Loop to update a Picklist field on each line item by assigning an unmapped Record Type Name string directly before executing an in-loop Update element.

Answer

Place a Decision element inside the Loop to check item status, accumulate the total value using an Assignment element inside the Loop, and execute a single Update Records element after the loop completes.
The design pattern of performing filtering with a Decision element and accumulation with an Assignment element inside a Loop, followed by a single Update Records element placed after the loop finishes, ensures that variable calculations occur in memory and database updates are bulkified without exceeding governor limits.

Step-by-Step Solution

1
Evaluate record relationship and aggregation requirements
Since Contract_Line_Item__cContract\_Line\_Item\_\_c is linked via a Lookup relationship, declarative Roll-Up Summary fields are unavailable.
Roll-up summary fields require a Master-Detail relationship.
2
Design loop iteration logic using Flow Builder elements
Filter items with a Decision element inside the Loop and add valid values to a variable via an Assignment element inside the Loop.
In-memory variable assignment allows calculations without database queries or updates.
3
Position database operations outside the loop construct
Perform the record update with an Update Records element on the path connected after the Loop finishes processing all items.
Placing data manipulation elements (DML) outside loops prevents reaching the limit of 150 DML statements per transaction.

Key Concept

Flow Builder Loop and Assignment Logic Bulkification
Rate this question