A Salesforce Administrator is designing a record-triggered flow on a custom Contract object that executes when a Contract status updates to Activated. The flow must process all associated child Contract Line Item records linked via a custom lookup relationship, calculate total values, and update fields on both the line items and the parent Contract record while strictly avoiding governor limit violations. Which two design choices should the administrator implement within Flow Builder?
- Use an Assignment element inside the loop to aggregate values into variables and add modified line items to a record collection variable.Cevap
- BPlace a Get Records element inside the loop to dynamically fetch full field details for each child Contract Line Item record during each iteration.
- Position the Update Records element after the loop execution path to update the record collection in a single transaction.Cevap
- DCreate a Roll-Up Summary field on the parent Contract object to calculate the total amount across the lookup relationship without using flow logic.
Cevap
The administrator should use an Assignment element inside the loop to accumulate totals and build a record collection in memory, and position the Update Records element after the loop path to perform a single bulkified DML operation.
To process multiple child records without reaching governor limits, calculations and record updates must be handled in memory within the loop using Assignment elements. The actual database update is bulkified by placing a single Update Records element outside the loop to process the accumulated collection.
Adım Adım Çözüm
Anahtar Kavram
Flow Builder Bulkification and Element Placement Rules