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?
- 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
- BIterate 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.
- CUse a Roll-up Summary calculation element within the loop to aggregate Case status values onto the parent Account record before inserting each Task.
- DAdd 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
Key Concept
Flow Bulkification and Governor Limits
Estimated Time:1m 30s