Soru

Zorluk: OrtaFlow Resources and Data Manipulation

An organization requires an automated process to deactivate expired Customer Loyalty Promotion records and archive their allocations when a marketing campaign concludes.

In what sequential order should the Flow Builder elements and resource assignments be arranged to update these records while adhering to Salesforce bulkification standards?

  1. 1Query and store all qualifying expired Customer Loyalty Promotion records in a record collection variable using a Get Records element.
  2. 2Pass the retrieved record collection variable into a Loop element to evaluate each record individually.
  3. 3Set the Status field to 'Inactive' on the current item record variable using an Assignment element.
  4. 4Add the modified current item record variable to an update record collection variable using an Assignment element.
  5. 5Commit all changes to the database by executing a single Update Records element using the update collection variable on the 'After Last Item' path.

Cevap

The proper execution order is: 1) Query records into a collection variable via Get Records, 2) Pass the collection into a Loop element, 3) Modify field values on the current loop item variable with an Assignment element, 4) Add the updated item variable to a secondary collection variable with an Assignment element, and 5) Execute an Update Records element on the secondary collection after the loop completes.
To adhere to Flow bulkification best practices and manage resources properly, records are retrieved once into a collection, iterated over via a Loop, modified via Assignment elements, staged into a separate collection variable with the 'Add' operator, and finally committed in a single DML operation on the 'After Last Item' path.

Adım Adım Çözüm

1
Retrieve candidate records with a Get Records element.
A record collection variable containing all matching expired loyalty promotions is populated in memory.
Data manipulation in Flow begins by querying the records that require processing.
2
Connect the collection variable to a Loop element.
The Flow begins iterating over each individual record using the loop's current item reference.
Iteration allows individual record field inspection and manipulation.
3
Use an Assignment element to modify fields on the current loop item.
The current item variable holds the updated Status value in memory.
Values must be assigned to the single record variable before adding it to an output collection.
4
Use a second Assignment operator (Add) to append the current item to a target collection variable.
The target collection accumulates updated records across all loop iterations.
Bulkification requires grouping modified records into a collection rather than saving each one individually.
5
Place an Update Records element on the 'After Last Item' connector referencing the target collection.
A single bulk DML statement updates all records in the database simultaneously.
Performing DML outside of loop constructs conserves transaction governor limits.

Anahtar Kavram

Flow bulkification design pattern using record collection variables, loop iteration, assignment staging, and external DML execution.
Bu soruyu puanla