Question

Difficulty: MediumFlow Resources and Data Manipulation

An administrator is building an automation on the custom Course Offering object. When a Course Offering status is updated to 'Cancelled', the status of all associated Student Enrollment records must be changed to 'Cancelled'. To prevent hitting governor limits when updating large batches of enrollments, which approach should the administrator use to configure the Flow resources and data manipulation elements?

  1. A
    Iterate through the retrieved enrollments using a Loop element, use an Update Records element inside the loop to modify each record directly, and end the flow.
  2. Iterate through the retrieved enrollments using a Loop element, assign the updated status to the loop item, add each item to a new collection variable using an Assignment element, and execute a single Update Records element after the loop finishes.Answer
  3. C
    Configure a before-save (Fast Field Updates) record-triggered flow on Course Offering to update the related Student Enrollment records directly without using collection variables.
  4. D
    Iterate through the enrollments and use a Get Records element inside the loop body to fetch each individual enrollment before applying changes directly to the parent record.

Answer

Iterate through the retrieved enrollments using a Loop element, assign the updated status to the loop item, add each item to a new collection variable using an Assignment element, and execute a single Update Records element after the loop finishes.
Bulkifying data manipulation in Salesforce Flow requires making all field modifications in memory using a Loop and Assignment elements, staging the modified records into a collection variable, and executing a single Update Records element after the loop path completes.

Step-by-Step Solution

1
Retrieve related records into a Record Collection Variable
A collection containing all related Student Enrollment records is stored in memory using a single Get Records element.
Bulkifying data retrieval requires querying all necessary child records in a single SOQL operation before looping.
2
Iterate and modify fields in memory using Assignment elements
The loop item field is updated, and the item is appended (Add operator) to a second Record Collection Variable designated for updates.
Using Assignment elements to manipulate variables in memory does not consume database DML operations.
3
Execute a single Update Records element after the Loop finishes
All modified records in the update collection are committed to the database in a single DML statement.
Performing data manipulation outside of the loop ensures the flow adheres to Salesforce governor limits.

Key Concept

Bulkification and Data Manipulation in Salesforce Flow
Estimated Time:1m 15s
Rate this question