Soru

Zorluk: OrtaFlow Resources and Data Manipulation

A company needs an automation that updates the Follow-Up Status field to 'Urgent' on all active Service Subscriptions whenever a Customer Incident is marked as 'Critical'. An administrator creates an autolaunched flow that retrieves the collection of related Service Subscriptions.

How should the administrator configure the flow resources and data manipulation elements to update these records without exceeding governor limits?

  1. A
    Iterate over the retrieved collection in a Loop element, update the Follow-Up Status field directly using an Update Records element inside the loop, and terminate the flow.
  2. Iterate through the collection with a Loop element, update each record variable with an Assignment element, add it to a new collection variable in a second Assignment element, and update the new collection with a single Update Records element after the loop.Cevap
  3. C
    Configure a Fast Field Updates (before-save) flow to modify the related Service Subscription records directly before the triggering record is saved to the database.
  4. D
    Use an Assignment element to update the triggering Incident record and depend on system validation rules to cascade the field updates to the related Service Subscription records.

Cevap

Iterate through the collection with a Loop element, update each record variable with an Assignment element, add it to a new collection variable in a second Assignment element, and update the new collection with a single Update Records element after the loop.
The standard and efficient pattern for manipulating multiple records in Salesforce Flow requires iterating over the retrieved collection with a Loop element, modifying the record values in memory via Assignment elements, adding the updated items into a second collection variable, and executing a single Update Records element after the loop finishes. This ensures only one DML transaction is consumed regardless of how many records are processed.

Adım Adım Çözüm

1
Query related records into a record collection variable using a Get Records element.
A collection containing all active Service Subscription records linked to the incident is stored in memory.
Allows subsequent flow logic to process multiple records without issuing repeated SOQL queries.
2
Pass the collection into a Loop element to iterate over each item.
The current item in the loop is assigned to the loop current item record variable.
Individual records must be evaluated and modified one by one in memory.
3
Use an Assignment element to update the Follow-Up Status field on the loop item variable, and a second Assignment line to add the modified item to a separate update collection variable.
The changes are accumulated in a staged record collection variable in memory without executing DML statements.
Prevents placing DML operations inside the loop, preserving transaction governor limits.
4
Connect the 'After Last Item' path of the Loop element to a single Update Records element pointing to the update collection variable.
All modified records are committed to the database in a single DML operation.
Bulkifies the data manipulation operation to consume only one DML statement out of the 150 transaction limit.

Anahtar Kavram

Bulkification in Salesforce Flow using Loop, Assignment, and Collection Resources
Tahmini Süre:1m 15s
Bu soruyu puanla