Soru

Zorluk: Çok zorFlow Builder Elements and Logic

An organization requires a Record-Triggered Flow on the Opportunity object that fires when an Opportunity reaches the 'Closed Won' stage. For each child Opportunity Line Item belonging to a specific Product Family, the automation must generate a corresponding custom Renewal Contract record and calculate an aggregated total renewal amount to update on the parent Account record. To adhere strictly to Salesforce governor limits and Flow Builder best practices, how should the administrator design the Flow elements and logic?

  1. Fetch child Opportunity Line Items using a Get Records element, iterate using a Loop element, use Assignment elements inside the loop to accumulate the renewal amount into a Currency variable and add instantiated Renewal Contract records to a Record Collection variable, then invoke a single Create Records element and a single Update Records element outside the loop.Cevap
  2. B
    Iterate through each child Opportunity Line Item using a Loop element, execute a Get Records element inside the loop to pull product details, and execute a Create Records element inside the loop to immediately create each Renewal Contract record.
  3. C
    Configure the automation as a Before-Save (Fast Field Updates) Record-Triggered Flow on the Opportunity object, incorporating the Loop element to create child Renewal Contract records and update the parent Account record directly.
  4. D
    Create a Roll-Up Summary field on the Account object to sum Opportunity Line Item values across lookup relationships, eliminating the need for Assignment or Update Records elements within the flow logic.

Cevap

Use a Get Records element to retrieve line items, iterate through them with a Loop element, collect instantiated records into a collection variable and sum metrics using Assignment elements, and perform DML operations using Create Records and Update Records elements placed outside the loop.
Bulkification in Flow Builder requires accumulating data changes in variable collections during iteration and executing a single database element outside the loop. Using Assignment elements within the loop to populate a Record Collection and aggregate amounts, followed by executing Create Records and Update Records outside the loop, keeps SOQL and DML counts at 1 regardless of the number of line items processed.

Adım Adım Çözüm

1
Retrieve related child records outside of any loop structure.
Obtain all required Opportunity Line Item records in a single SOQL query via a Get Records element.
Prevents executing data queries inside iteration loops.
2
Iterate over the retrieved record collection using a Loop element.
Process each line item sequentially using current item loop variables.
Allows individual evaluation and assignment of values for each record.
3
Use Assignment elements inside the loop to populate record variables and collection variables.
Accumulate values in a total currency variable and add individual record instances to a Record Collection variable.
Prepares all memory variables without executing database operations during loop iterations.
4
Perform database operations using single DML elements outside the loop.
Execute one Create Records operation for the collection and one Update Records operation for the parent Account.
Ensures the flow remains fully bulkified and complies with DML governor limits.

Anahtar Kavram

Flow Builder Bulkification and Data Manipulation Logic
Bu soruyu puanla