Soru

Zorluk: OrtaFlow Resources and Data Manipulation

An administrator at Cloud Kicks is configuring an automation on the custom Onboarding Project object. When an Onboarding Project is marked as 'Expedited', the flow must find all related open Onboarding Task records and change their Priority to 'High'. Which design approach should the administrator use to update the task records efficiently without exceeding governor limits?

  1. Retrieve the open tasks with a Get Records element, iterate through them in a Loop, modify the field values and add each record to a new collection using Assignment elements, and execute a single Update Records element on the collection after the loop finishes.Cevap
  2. B
    Retrieve the open tasks with a Get Records element, loop through the collection, and execute an Update Records element inside the loop on each iteration to commit changes immediately.
  3. C
    Configure the automation as a Fast Field Updates (before-save) record-triggered flow and use an Assignment element to write updates directly to the related child records without a DML element.
  4. D
    Use a Get Records element inside the loop to fetch each related task record individually, apply the field changes, and rely on system validation rules to commit the updates automatically.

Cevap

Retrieve the open tasks with a Get Records element, iterate through them in a Loop, modify the field values and add each record to a new collection using Assignment elements, and execute a single Update Records element on the collection after the loop finishes.
The correct approach follows Salesforce bulkification standards: records are fetched in a single query, modified in memory through loop iterations and Assignment elements, and committed using a single Update Records DML element pointing to the collection variable after the loop concludes.

Adım Adım Çözüm

1
Query related child records before the loop
A record collection variable containing all related open Onboarding Task records is created.
Issuing a single SOQL query via a Get Records element outside any loop avoids SOQL query governor limits.
2
Iterate and stage record modifications in memory using Assignment elements
The current item's Priority is set to 'High', and the record is appended to a secondary collection variable.
Assignment elements perform operations in memory without consuming DML statement limits.
3
Perform database commit using an Update Records element on the collection variable after loop completion
All updated Onboarding Task records are committed to the database in a single DML operation.
Executing a single DML operation on a collection variable outside the loop ensures the flow is fully bulkified.

Anahtar Kavram

Flow Bulkification and Collection Manipulation
Tahmini Süre:1m 15s
Bu soruyu puanla