Question

Difficulty: MediumFlow Builder Elements and Logic

A Salesforce Administrator is designing an autolaunched flow to update related records when a Project record's status changes to 'Completed'. The flow must set the status of all open child Project Task records to 'Closed'. Which TWO implementation strategies should the administrator use within Flow Builder to fulfill this business requirement efficiently without exceeding governor limits?

  1. Execute a single Get Records element before any loop to retrieve all open Project Task records associated with the Project.Answer
  2. Iterate through the retrieved records, modify the status using an Assignment element inside the loop, and execute a single Update Records element outside the loop on the record collection variable.Answer
  3. C
    Place an Update Records element directly inside the Loop element to immediately save changes for each Project Task record as it is processed.
  4. D
    Create a Roll-Up Summary field on the parent Account record using its standard Lookup relationship to child Project Tasks to update the count without using Flow logic.

Answer

The administrator should execute a single Get Records element outside any loop to query the necessary Project Task records and use an Assignment element inside the loop to aggregate modified records into a collection variable, followed by a single Update Records element outside the loop.
To maintain optimal flow execution and adhere to Salesforce governor limits, data retrieval (Get Records) and data manipulation (Update Records) elements must always be placed outside of loops. Using an Assignment element inside the loop allows for field values to be set in a collection variable in memory, enabling a single bulk update operation once loop processing completes.

Step-by-Step Solution

1
Query related open Project Task records using a Get Records element positioned prior to any loop construct.
All target records are stored in a record collection variable using a single SOQL query.
Placing data query elements outside loops adheres to Salesforce governor limit best practices.
2
Loop through the record collection, using an Assignment element to update the field values on a current loop item and add it to a secondary output collection variable.
Record field modifications are staged in memory without triggering database transactions.
In-memory variable manipulation consumes no DML governor limits.
3
Pass the populated secondary record collection to a single Update Records element located after the Loop path completes.
All modified Project Task records are written to the database in one bulk transaction.
A single DML statement updates all records efficiently in batch mode.

Key Concept

Flow Bulkification and Governor Limit Prevention
Rate this question