Soru

Zorluk: ZorFlow Resources and Data Manipulation

A Salesforce Administrator is configuring a scheduled flow to process thousands of closed Case records nightly. For each processed record, the flow must update a summary field on the parent Account and create a custom Case_Audit__c record to store historical tracking details. Which two flow design choices ensure the flow processes records efficiently without exceeding governor limits?

  1. Populate individual Case_Audit__c record variables within the loop, add them to a record collection variable using an Assignment element, and execute a single Create Records element outside the loop.Cevap
  2. B
    Place a Create Records element inside the loop immediately after assigning values to the Case_Audit__c record variable to commit each audit log in real time.
  3. Update Account record variable values inside the loop, append each modified Account record to an Account collection variable using an Assignment element, and execute a single Update Records element after the loop finishes.Cevap
  4. D
    Add a Get Records element inside the loop prior to updating each parent Account record to ensure the flow works with the latest database values.

Cevap

The administrator should use Assignment elements inside the loop to append individual record variables to collection variables, followed by executing single Create Records and Update Records data elements outside the loop.
To follow Salesforce bulkification practices when manipulating data in flows, all data operations (SOQL queries and DML updates/creates) must occur outside of loop iterations. The correct choices collect modified and newly created record variables into collection resources via Assignment elements inside the loop, then execute bulk Create Records and Update Records operations outside the loop using those collection variables.

Adım Adım Çözüm

1
Evaluate data manipulation requirement inside the loop
Identify that field assignments must be stored temporarily without interacting directly with the Salesforce database.
Direct database queries or DML operations executed within a loop consume transaction limits per iteration.
2
Use Assignment elements to accumulate records into collection variables
Individual record variables for Case_Audit__c and modified Account records are added to their respective collection variables during each iteration.
Collection variables hold multiple record values in memory until the loop finishes processing.
3
Execute DML operations on the collection variables outside the loop
A single Create Records element inserts all audit logs, and a single Update Records element updates all affected Accounts in bulk.
Invoking DML elements outside the loop consumes only 1 DML statement per collection operation, maintaining bulkification compliance.

Anahtar Kavram

Flow Bulkification and Data Manipulation outside Loops
Bu soruyu puanla