Soru

Zorluk: Çok zorFlow Types and Triggers

An organization is optimizing its automation architecture for a custom object named Inspection__c. When an Inspection__c record is modified and marked as 'Completed', the system must fulfill three specific requirements:

1. Calculate and populate the Internal_Compliance_Code__c field directly on the triggering Inspection__c record prior to committing changes to the database.
2. Update the Total_Inspections__c counter on the related parent Facility__c record.
3. Send an HTTP web request to an external auditing endpoint to log the completion event.

Which automation design best adheres to Salesforce performance best practices while minimizing transaction overhead and avoiding governor limit exceptions?

  1. Implement a Fast Field Updates (Before-Save) record-triggered flow to update the Internal_Compliance_Code__c on the triggering record, and an Actions and Related Records (After-Save) record-triggered flow featuring an Asynchronous Path to update the parent Facility__c record and execute the external callout.Cevap
  2. B
    Implement a single Actions and Related Records (After-Save) record-triggered flow containing an Update Records element for the triggering Inspection__c record, an Update Records element for the parent Facility__c record, and an Apex action element for the external callout within the synchronous path.
  3. C
    Implement a Schedule-Triggered Flow running every hour that queries all Inspection__c records marked as 'Completed' within the last hour, updates the Internal_Compliance_Code__c and parent Facility__c records in a loop, and executes the external callout.
  4. D
    Implement a Fast Field Updates (Before-Save) record-triggered flow that assigns the Internal_Compliance_Code__c, performs a Get Records and Update Records on the parent Facility__c record, and triggers an Apex callout action.

Cevap

Implement a Fast Field Updates (Before-Save) record-triggered flow for same-record updates, alongside an Actions and Related Records (After-Save) record-triggered flow utilizing an Asynchronous Path for related record updates and external callouts.
The solution that combines a Fast Field Updates (Before-Save) record-triggered flow with an Actions and Related Records (After-Save) record-triggered flow utilizing an Asynchronous Path follows official Salesforce architectural best practices. Before-Save flows update fields on the triggering record without incurring DML overhead. After-Save flows handle related record updates and external callouts, while the Asynchronous Path isolates the callout to avoid 'uncommitted work pending' errors and separate governor limits.

Adım Adım Çözüm

1
Evaluate same-record field assignment requirement
Identify that populating fields on the triggering record prior to database commit is best handled via Before-Save (Fast Field Updates) flow triggers.
Before-Save record-triggered flows execute up to 10x faster than After-Save flows because they modify the record buffer directly without calling explicit DML update operations or re-triggering validation rules.
2
Evaluate related record update and external integration requirements
Determine that updating the parent Facility__c record and executing an HTTP callout require an After-Save (Actions and Related Records) flow context.
Related records can only be safely updated once the primary record ID exists and initial system validations pass in the After-Save phase.
3
Select the correct execution path for the external callout
Place the callout and related record updates in an Asynchronous Path within the After-Save flow.
Salesforce prohibits synchronous callouts when uncommitted DML operations exist in the transaction. Moving callouts to an Asynchronous Path executes them in a separate background thread with fresh governor limits.

Anahtar Kavram

Record-Triggered Flow Types, Execution Timing (Before vs. After Save), and Asynchronous Paths
Tahmini Süre:2m 0s
Bu soruyu puanla