Soru

Zorluk: OrtaFlow Resources and Data Manipulation

An administrator is building an autolaunched flow to update the status of all active Software License records to 'Inactive' whenever a parent Contract record is marked as 'Expired'. The flow must handle bulk updates safely without exceeding Salesforce governor limits. Which two design practices should the administrator implement in the flow design?

  1. Use a Get Records element before the Loop element to retrieve all related active Software License records into a record collection variable.Cevap
  2. Use an Assignment element inside the Loop element to add modified record variables to a record collection variable, then use a single Update Records element after the loop.Cevap
  3. C
    Place an Update Records element inside the Loop element to save changes to each Software License record immediately during each iteration.
  4. D
    Place a Get Records element inside the Loop element to query the latest field values for each Software License record individually.

Cevap

The administrator should retrieve all related records into a record collection variable using a single Get Records element before entering the loop, and use an Assignment element inside the loop to accumulate modified records into a collection variable before executing a single Update Records element after the loop.
Bulkifying flows requires moving database interactions (SOQL queries and DML operations) outside of loops. Retrieving records into a collection before the loop executes a single query, and accumulating modified record variables into a collection variable to update with a single Update Records element after the loop minimizes transaction overhead and adheres to Salesforce governor limits.

Adım Adım Çözüm

1
Query records outside the loop
A single Get Records element retrieves all target records into a record collection variable prior to looping.
Prevents hitting the governor limit of maximum SOQL queries issued per transaction.
2
Process and stage changes in memory
Inside the loop, field values are modified on the loop variable and added to an output collection variable using an Assignment element.
Allows staging of multiple record modifications in memory without executing immediate database DML calls.
3
Commit changes in bulk after the loop
A single Update Records element processes the updated collection variable after loop completion.
Executes one bulk DML operation, ensuring scalable flow execution within transaction limits.

Anahtar Kavram

Flow Bulkification and Governor Limits
Bu soruyu puanla