A Salesforce Administrator is building an autolaunched flow to update several Lead records based on specific business criteria. The administrator retrieves a collection of target Leads using a Get Records element. Next, the flow needs to change the Lead Status to 'Closed - Not Converted' and set a custom field value on each record in the collection. Which design pattern should the administrator follow to process and update these records efficiently while staying within Salesforce governor limits?
- Loop through the Lead collection, use an Assignment element inside the loop to set field values and add each updated record to a new record collection variable, and place a single Update Records element outside the loop.Answer
- BLoop through the Lead collection and place an Update Records element inside the loop to commit field changes for each Lead record individually as it is processed.
- CUse a Roll-Up Summary field on the Lead object to automatically update child record statuses and picklist assignments without using a Loop element.
- DAssign the new Lead Status in an Assignment element inside the loop, but omit configuring the Record Type ID on the record variable assuming picklists update across record types automatically.
Answer
The administrator should loop through the Lead collection, assign the updated values and collect records using an Assignment element inside the loop, and execute a single Update Records element outside the loop.
The correct approach follows bulkification best practices by accumulating modified record variables into a collection using Assignment elements inside the loop, followed by a single Update Records DML element executed outside the loop.
Step-by-Step Solution
Key Concept
Bulkification in Flow Builder