Soru

Zorluk: OrtaFlow Builder Elements and Logic

An administrator is designing an after-save record-triggered flow on the Account object to update all related open Work Orders when an Account is marked as inactive. To ensure optimal performance and avoid reaching SOQL and DML governor limits, which two design practices should the administrator follow? (Select 2 answers.)

  1. Execute a single Get Records element outside of any loop to retrieve all open Work Orders into a record collection variable.Cevap
  2. B
    Place an Update Records element inside the Loop element to immediately save changes for each individual Work Order.
  3. Use an Assignment element within the loop to update record values in a collection, then execute a single Update Records element after the loop completes.Cevap
  4. D
    Create a Roll-Up Summary field on the Account object to perform the field updates on child records over a lookup relationship.

Cevap

The administrator should execute a single Get Records element outside of any loop to retrieve open Work Orders into a collection variable, and use an Assignment element inside the loop to accumulate changes in a collection before calling a single Update Records element after the loop.
To design bulkified flows that respect Salesforce governor limits, data retrieval (Get Records) and data manipulation (Update Records) elements must be placed outside of loops. The flow should fetch all target records in a single SOQL query, iterate over the collection to assign new field values in memory, and update the modified collection using a single DML operation after the loop completes.

Adım Adım Çözüm

1
Retrieve related records efficiently
Obtained all target child records using a single Get Records element prior to loop entry.
Issuing data retrieval requests outside loops bulkifies data access and prevents SOQL 101 limit exceptions.
2
Modify records iteratively within a collection
Updated field values in memory using Assignment elements and added modified records to an output collection.
In-memory variable assignments do not count against governor execution limits.
3
Persist changes in bulk
Executed one Update Records element on the output collection after loop termination.
Performing a single DML operation on the collection minimizes transaction costs and respects DML governor limits.

Anahtar Kavram

Bulkification in Flow Builder
Bu soruyu puanla