Soru

Zorluk: ZorOrder of Execution and Automation Considerations

An enterprise Salesforce environment processes updates on the Opportunity object using multiple automation and code features. The object configuration includes Before-Save Record-Triggered Flows, Apex Before Triggers, Custom Validation Rules, Apex After Triggers, and After-Save Record-Triggered Flows. Which two statements correctly describe the sequence of execution and system behavior during a save operation?

  1. Custom Validation Rules are evaluated after Before-Save Record-Triggered Flows and Apex Before Triggers have finished running.Cevap
  2. Field updates made by Before-Save Record-Triggered Flows modify the record in memory without firing a separate DML operation or re-evaluating validation rules.Cevap
  3. C
    Custom Validation Rules execute before Before-Save Record-Triggered Flows to prevent invalid data from being processed by automated flows.
  4. D
    Apex Before Triggers execute after Custom Validation Rules have passed to ensure trigger logic only operates on validated field values.
  5. E
    After-Save Record-Triggered Flows execute immediately after saving to the database, prior to the execution of Apex After Triggers.

Cevap

The correct statements are that Custom Validation Rules execute after Before-Save Record-Triggered Flows and Apex Before Triggers, and field updates performed by Before-Save Record-Triggered Flows modify the record in memory without triggering additional DML operations.
During a record save operation, Salesforce executes Before-Save Record-Triggered Flows first, followed by Apex Before Triggers. Only after these pre-save events finish does the system evaluate Custom Validation Rules. Furthermore, modifications made inside Before-Save Record-Triggered Flows update the record directly in memory, which avoids creating additional DML operations or re-triggering validation rules.

Adım Adım Çözüm

1
Analyze the pre-save phase of the Salesforce Order of Execution.
Before-Save Record-Triggered Flows run first, followed immediately by Apex Before Triggers.
Salesforce prioritizes lightweight in-memory record adjustments prior to executing code handlers and validation checks.
2
Determine when validation rules occur relative to pre-save logic.
System and Custom Validation Rules run after Apex Before Triggers complete.
This guarantees that any field values assigned programmatically by before-save automation are checked by validation logic before being saved.
3
Evaluate post-save automation order.
The record is saved to the database (uncommitted), Apex After Triggers run, and then deferred automation like After-Save Flows and Workflows execute.
Apex After Triggers always take precedence over After-Save Record-Triggered Flows.

Anahtar Kavram

Salesforce Order of Execution during record save operations
Bu soruyu puanla