Soru

Zorluk: ZorFlow Types and Triggers

A Salesforce administrator needs to implement automation on the custom object Order_Line_Item__c to fulfill two business requirements:

1. Whenever an Order_Line_Item__c record is created or updated and its Discount_Percent__c field is changed, the flow must calculate and populate Discounted_Price__c on the triggering record before it is committed to the database.
2. When Fulfillment_Status__c is changed to 'Backordered', the automation must create a follow-up Task record for the warehouse team and perform an external REST API callout to notify a vendor system.

Which combination of flow types and trigger configurations represents the optimal architecture to fulfill these requirements while following Salesforce performance and governor limit best practices?

  1. A
    Create a single Record-Triggered Flow configured for Actions and Related Records (after-save) that uses an Update Records element for the triggering record, creates the Task, and performs the callout synchronously in the main execution path.
  2. Create a Fast Field Updates (before-save) Record-Triggered Flow to populate Discounted_Price__c on the triggering record, and a separate Actions and Related Records (after-save) Record-Triggered Flow with an Asynchronous Path to create the Task and execute the external API callout.Cevap
  3. C
    Create an Autolaunchable Flow invoked by a Workflow Rule field update to populate Discounted_Price__c, and use a Process Builder process to create the Task and invoke an Apex callout.
  4. D
    Create a Schedule-Triggered Flow running every 15 minutes that queries all modified Order_Line_Item__c records, uses a Loop element to evaluate changes, updates Discounted_Price__c via an Update Records element inside the loop, and creates related Tasks.

Cevap

The optimal architecture uses a Fast Field Updates (before-save) Record-Triggered Flow to set field values on the triggering record, combined with an Actions and Related Records (after-save) Record-Triggered Flow utilizing an Asynchronous Path for related record creation and external callouts.
The design combining a Fast Field Updates (before-save) flow for same-record updates with an Actions and Related Records (after-save) flow utilizing an Asynchronous Path follows Salesforce architectural best practices. Before-save flows update fields on the triggering record before database write operations, offering up to 10x faster execution without triggering additional DML operations. After-save flows are required to create related records (such as Tasks) and access the saved Record ID, while the Asynchronous Path isolates the external callout to prevent 'uncommitted work pending' errors.

Adım Adım Çözüm

1
Analyze requirement 1 (same-record updates prior to database commit).
Identified that Fast Field Updates (before-save) Record-Triggered Flow is required.
Before-save flows execute before the record is written to the database, updating fields on $Record directly without requiring an Update Records DML element and without re-triggering validation rules or triggers.
2
Analyze requirement 2 (creating related Task records and making external callouts).
Identified that Actions and Related Records (after-save) Record-Triggered Flow is required.
Related records cannot be created before the parent record has an ID. Additionally, HTTP callouts cannot be executed in before-save flows.
3
Determine transactional separation for external callouts.
Configured an Asynchronous Path on the after-save flow.
Salesforce prevents HTTP callouts after DML operations in the same transaction unless executed asynchronously on an Asynchronous Path or via background processing.

Anahtar Kavram

Selecting Optimal Record-Triggered Flow Execution Types and Trigger Paths
Tahmini Süre:2m 0s
Bu soruyu puanla