Soru

Zorluk: OrtaFlow Builder Elements and Logic

An administrator needs to build an autolaunched Flow that updates all open Opportunity records associated with an Account when the Account's rating changes. The Flow retrieves the related opportunities into a record collection using a Get Records element and processes them using a Loop element. Which design pattern should the administrator implement to efficiently update the records while adhering to Salesforce governor limit best practices?

  1. Use an Assignment element inside the Loop to update field values on the current record item, a second Assignment element inside the Loop to add the updated record to a new collection variable, and a single Update Records element outside the Loop.Cevap
  2. B
    Place an Update Records element directly inside the Loop element immediately following an Assignment element that modifies each Opportunity record variable.
  3. C
    Convert the Account and Opportunity relationship to Master-Detail and place a Get Records element inside the Loop element to calculate roll-up summary values for each opportunity.
  4. D
    Use a Decision element inside the Loop to assign a new Record Type to each Opportunity without configuring available picklist values for that destination Record Type.

Cevap

Use an Assignment element inside the Loop to update field values on the current record item, a second Assignment element inside the Loop to add the updated record to a new collection variable, and a single Update Records element outside the Loop.
The correct design pattern follows Salesforce flow bulkification standards: field updates are staged in memory using Assignment elements inside the loop, collected into a secondary Record Collection variable, and saved to the database in a single transaction via an Update Records element placed after the loop finishes.

Adım Adım Çözüm

1
Retrieve related records
Store all open Opportunity records in a Record Collection variable using a single Get Records element prior to entering the loop.
Queries performed prior to loop iteration ensure SOQL governor limits are respected.
2
Iterate and modify records in memory
Use a Loop element to iterate over the collection. Inside the loop, use an Assignment element to update values on the loop item, then use a second Assignment element to add the modified loop item to a secondary output Record Collection variable.
Updating fields in memory across iterations avoids executing individual database updates during the loop execution.
3
Perform bulkified database update
Connect the 'After Last' path of the Loop element to a single Update Records element that references the secondary output Record Collection variable.
Executing a single DML operation after the loop finishes processes all modified records in one transaction, avoiding governor limit exceptions.

Anahtar Kavram

Bulkification and DML placement in Salesforce Flow Builder
Bu soruyu puanla