Soru

Zorluk: OrtaFlow Resources and Data Manipulation

An administrator is configuring a flow to update all open Support Case records associated with an Account when its support tier is upgraded. The flow uses a Get Records element to retrieve the related open cases and iterates through them using a Loop element to set their Priority field to 'High'. What should the administrator do within the loop to prepare the records for update without exceeding Salesforce governor limits?

  1. Modify the current loop item's Priority field using an Assignment element, and then use a second Assignment element to add the current loop item to a new record collection variable.Cevap
  2. B
    Place an Update Records element inside the loop to save the updated Priority value to Salesforce during each iteration.
  3. C
    Use a Get Records element inside the loop to re-fetch the Case record before updating its Priority field with an Assignment element.
  4. D
    Use a Decision element inside the loop to execute an Update Records element only on every second iteration.

Cevap

Modify the current loop item's field values using an Assignment element, append the current loop item to a record collection variable using a second Assignment element, and execute a single Update Records element after the loop completes.
The correct practice for manipulating data inside a Flow loop is to update field values on the current record item using an Assignment element, and then use another Assignment element to add that record item into a record collection variable. After the loop completes, a single Update Records element is executed on the collection variable, adhering strictly to Salesforce governor limit and bulkification guidelines.

Adım Adım Çözüm

1
Update record fields in memory
The current item variable from the loop has its Priority field set to 'High'.
Field values should be modified in memory without committing changes directly to the database.
2
Aggregate records into a collection variable
The updated current loop item is added to a record collection variable using the 'Add' operator in an Assignment element.
Collecting modified records allows bulk processing of DML statements outside the loop body.
3
Execute bulk database update after the loop
A single Update Records element references the record collection variable after the loop finishes.
Performing a single DML operation outside the loop ensures the flow stays well within governor limits.

Anahtar Kavram

Bulkification in Salesforce Flow using Assignment elements and Record Collections
Tahmini Süre:1m 30s
Bu soruyu puanla