A Salesforce Administrator is designing a record-triggered flow on the custom object . When a renewal record is marked as 'High Risk', the flow must retrieve all related 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 record with the calculated total. Which element structure and configuration represents the most efficient, governor-limit-safe implementation in Flow Builder?
- 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
- BPlace 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.
- CCreate a standard Roll-Up Summary field on the object to sum active values directly instead of using Flow Builder elements.
- DUse 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
Key Concept
Flow Builder Loop and Assignment Logic Bulkification