Soru

Zorluk: ZorFlow Resources and Data Manipulation

Universal Containers requires a Screen Flow that allows customer support representatives to select multiple active Asset records associated with an Account and update their Warranty Expiration Date to a newly selected date. The flow must process up to 200 Asset records in a single execution without breaching Salesforce governor limits. What should the administrator configure in Flow Builder to fulfill this requirement?

  1. Iterate through the selected Asset collection using a Loop element, update the Warranty Expiration Date on the loop record using an Assignment element, append the loop record to a new Asset record collection variable, and execute a single Update Records element after the loop finishes using the new collection variable.Cevap
  2. B
    Iterate through the selected Asset collection using a Loop element, update the Warranty Expiration Date field using an Assignment element, and place an Update Records element inside the loop to commit each Asset update individually.
  3. C
    Place a Get Records element inside a Loop element to fetch each Asset individually by ID, update the Warranty Expiration Date on the retrieved record, and invoke an Update Records element inside the loop.
  4. D
    Iterate through the selected Asset collection using a Loop element, and use an Update Records element inside the loop configured to filter for all Asset records matching the Account ID.

Cevap

The administrator should iterate through the Asset collection, update field values on the loop item using an Assignment element, add each updated record item to a secondary record collection variable inside the loop, and place a single Update Records element outside the loop referencing the secondary record collection.
The correct approach bulkifies database operations by modifying record field values in memory during loop execution, populating a new collection variable, and issuing a single Update Records DML call after loop iteration finishes.

Adım Adım Çözüm

1
Configure a Loop element to iterate through the input collection of selected Asset records.
Each Asset record in the collection is made available sequentially as the loop record variable.
Iterating over existing collection resources avoids performing SOQL queries inside loop paths.
2
Add an Assignment element inside the loop to set the new Warranty Expiration Date on the current loop item, and add a second assignment line to add the current loop item into a target record collection variable.
Field values are modified in memory and staged within a secondary collection without firing DML statements.
Staging records in memory across loop iterations preserves transaction resources and bulkifies data manipulation.
3
Place an Update Records element after the loop completes and set it to update records from the target record collection variable.
All updated Asset records are committed to the database in a single bulk DML statement.
Executing DML outside of loops ensures the flow stays well within the governor limit of 150 DML statements per transaction.

Anahtar Kavram

Flow Bulkification and Data Manipulation Best Practices
Tahmini Süre:2m 0s
Bu soruyu puanla