An administrator is tasked with updating the entitlement status and expiration dates on hundreds of custom Contract Line Item records whenever a parent Contract status changes to 'Expired'. The solution must update all related records reliably while adhering to Salesforce governor limits.
Which design pattern should the administrator implement in Flow Builder to perform this data manipulation efficiently?
- Loop through the retrieved Contract Line Items, use an Assignment element inside the loop to update the field values on the current item and append that item to a new Record Collection Variable, and place an Update Records element outside the loop referencing the new collection.Cevap
- BLoop through the retrieved Contract Line Items and place an Update Records element directly inside the loop to save field changes to Salesforce on each iteration.
- CLoop through a collection of Contract Line Item IDs, execute a Get Records element inside the loop to retrieve each record's full details, modify the fields, and execute an Update Records element outside the loop.
- DUse a Create Records element inside the loop to generate clone records with the updated status, then execute a Delete Records element outside the loop to remove the original records.
Cevap
Iterate through the line item collection using a Loop element, use an Assignment element inside the loop to update the current item variable and add it to a target Record Collection Variable, then execute a single Update Records element outside the loop.
The correct approach follows Salesforce bulkification best practices. By updating field values on the loop item variable and assigning that item to a separate Record Collection Variable within the loop, all record changes are staged in memory. A single Update Records element placed after the loop processes the entire collection in one database transaction, ensuring scalability and compliance with governor limits.
Adım Adım Çözüm
Anahtar Kavram
Bulkification in Flow Builder using Assignment elements and Record Collection Variables