Question

Difficulty: MediumFlow Builder Elements and Logic

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?

  1. 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
  2. B
    Loop 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.
  3. C
    Use a Roll-Up Summary field on the Lead object to automatically update child record statuses and picklist assignments without using a Loop element.
  4. D
    Assign 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

1
Retrieve Lead records into a collection variable
A record collection containing the target Lead records is populated using a single Get Records element.
Querying data once into a collection avoids repeated database calls.
2
Process records in a loop using Assignment elements
Each record in the loop has its field values updated in memory, and the updated record is added to a target output record collection.
Performing assignment operations in memory does not consume DML governor limits.
3
Execute Update Records outside the loop
All record modifications staged in the collection variable are committed to the database in a single transaction.
Executing a single DML operation outside the loop ensures the flow is bulkified and adheres to Salesforce governor limits.

Key Concept

Bulkification in Flow Builder
Rate this question