Question

Difficulty: MediumFlow Builder Elements and Logic

A company requires an automated process to update the status of multiple related Case records to 'Under Audit' and generate a follow-up Task for each Case owner whenever an Account's risk level increases. An administrator creates an autolaunched flow that retrieves the collection of related Cases using a Get Records element. To ensure the flow updates the Cases and creates the Tasks efficiently without exceeding Salesforce governor limits, how should the administrator structure the Flow elements and logic?

  1. Iterate through the Case collection, update Case field values and construct Task record variables using Assignment elements to append them into collection variables, then execute a single Update Records element and a single Create Records element outside the loop.Answer
  2. B
    Iterate through the Case collection using a Loop element, placing an Update Records element and a Create Records element directly inside the loop to process each record individually.
  3. C
    Use a Roll-up Summary calculation element within the loop to aggregate Case status values onto the parent Account record before inserting each Task.
  4. D
    Add a Decision element inside the loop to reassign picklist values based on record type before executing an immediate inline Create Records element for each Task.

Answer

Iterate through the Case collection, update Case field values and construct Task record variables using Assignment elements to append them into collection variables, then execute a single Update Records element and a single Create Records element outside the loop.
The correct approach follows Salesforce bulkification best practices by using Assignment elements within the loop to populate record and collection variables in memory. DML elements (Update Records and Create Records) are placed after the loop finishes so that all changes and insertions occur in single, bulkified transactions.

Step-by-Step Solution

1
Retrieve related records into a collection variable
A collection containing all target Case records is fetched using a single Get Records element.
Bulkifying data retrieval avoids issuing multiple query calls.
2
Loop and assign variable values without DML operations
Each iteration uses Assignment elements to update field values on the current item and add new Task records to a Task collection variable.
Assignment elements perform in-memory operations and do not count against DML governor limits.
3
Execute DML operations outside the loop
A single Update Records element updates the Case collection, and a single Create Records element creates the Task collection.
Executing DML elements outside the loop ensures the flow uses only 2 DML operations regardless of the number of records processed.

Key Concept

Flow Bulkification and Governor Limits
Estimated Time:1m 30s
Rate this question