A Salesforce Administrator needs to design an after-save record-triggered flow on the Order object when an Order is updated to 'Activated'. The business logic requires checking whether the total amount of related active Order Item records exceeds $50,000. If this threshold is met, the flow must set the 'Is_High_Value__c' checkbox on the triggering Order to true and update the 'Status__c' field on all related Hardware line items to 'Approved'. Which element design pattern and sequence correctly fulfills these requirements while adhering to Salesforce governor limits and best practices?
- APlace a Get Records element inside a Loop to query related Order Items individually, then execute an Update Records element inside the Loop for each line item that meets the criteria.
- BCreate a Roll-Up Summary field on the Order object to sum line item amounts across the lookup relationship, then use a Decision element to evaluate the total before executing an Update Records element inside a Loop.
- Execute a single Get Records element outside the loop to retrieve all related Order Items, iterate through them with a Loop and Decision element to calculate the running total, populate a Record Collection variable using an Assignment element inside the loop, and execute a single Update Records element outside the loop.Answer
- DAssign a new Record Type to each Order Item inside a Loop using an Assignment element without verifying picklist value assignments for that record type, followed by an Update Records element inside the loop.
Answer
The correct architecture retrieves Order Items using a single Get Records element outside the loop, calculates totals and accumulates modified items into a collection variable using an Assignment element inside the loop, and performs DML using a single Update Records element outside the loop.
The correct approach follows Salesforce bulkification standards. Fetching related records using a single Get Records element outside the loop, performing calculations and accumulating modified records into a collection variable via Assignment elements during loop iteration, and committing changes via a single Update Records element outside the loop ensures the flow runs efficiently within transaction governor limits.
Step-by-Step Solution
Key Concept
Flow Builder Bulkification and Data Manipulation Mechanics
Estimated Time:2m 0s