Soru

Zorluk: Çok zorFlow Types and Triggers

Global Freight Solutions requires an automated solution on the custom object Freight_Shipment__c when a record's status is updated to 'Dispatched'. The solution must fulfill three operational requirements:
1. Standardize and populate the custom field Formatted_Routing_Code__c on the triggering Freight_Shipment__c record prior to the database commit.
2. Update the Status__c field on all associated child Shipment_Item__c records to 'In Transit'.
3. Execute an HTTP callout to send shipment payload details to an external third-party logistics REST API.

Which combination of flow trigger configurations adheres to Salesforce performance and architecture best practices?

  1. Implement a Before-Save Record-Triggered Flow (Fast Field Updates) to populate Formatted_Routing_Code__c on the triggering record, and a separate After-Save Record-Triggered Flow (Actions and Related Records) utilizing an Asynchronous Path to update child Shipment_Item__c records and execute the external HTTP callout.Cevap
  2. B
    Implement a single After-Save Record-Triggered Flow (Actions and Related Records) that updates Formatted_Routing_Code__c using an Update Records element, updates child Shipment_Item__c records, and performs the HTTP callout synchronously on the main execution path.
  3. C
    Implement a single After-Save Record-Triggered Flow that uses a Loop element to iterate through child Shipment_Item__c records, placing a Get Records and Update Records element inside the loop to update each child record and execute the HTTP callout.
  4. D
    Implement a single Before-Save Record-Triggered Flow (Fast Field Updates) that updates Formatted_Routing_Code__c, performs a mass update on child Shipment_Item__c records, and executes an Apex action to invoke the external HTTP callout.

Cevap

Implement a Before-Save Record-Triggered Flow (Fast Field Updates) for same-record updates, alongside an After-Save Record-Triggered Flow with an Asynchronous Path for related record updates and external callouts.
The solution properly separates responsibilities according to Salesforce architectural guidelines. A Before-Save (Fast Field Updates) flow optimizes same-record updates by setting values in memory before saving to the database without additional DML calls. An After-Save flow using an Asynchronous Path allows related record updates and handles external HTTP callouts in a background thread, preventing callout governor limit exceptions.

Adım Adım Çözüm

1
Evaluate same-record field update requirements
Identify that Formatted_Routing_Code__c must be populated on the triggering record prior to database commit.
Fast Field Updates (Before-Save record-triggered flows) are optimized for modifying the triggering record because values are set directly in memory without firing additional DML statements or trigger re-entry.
2
Evaluate related record updates and external callout requirements
Determine that updating child Shipment_Item__c records and executing external HTTP callouts require post-save processing.
Before-Save flows cannot perform DML on related records or invoke external callout actions. Related record DML and HTTP callouts must occur in an After-Save flow.
3
Determine transaction boundary requirements for callouts
Assign callout and related record processing to an Asynchronous Path within an After-Save flow.
Executing HTTP callouts after DML in the same synchronous transaction causes uncommitted work pending exceptions. The Asynchronous Path runs in a separate thread, permitting callouts and database operations to execute safely.

Anahtar Kavram

Record-Triggered Flow Trigger Optimization & Asynchronous Execution Architecture
Bu soruyu puanla