0

I have a Flow that runs when an Opportunity is created or updated. The Flow is supposed to update some values on the ProductLineItems that are associated with the Opportunity.

Part of the Flow runs Synchronously -- this is the part that updates the values.

Part of the Flow runs Asynchronously -- this runs an Outbound Message that sends the values to an external data lake from which we generate reports.

However, right now the Outbound Message is being sent with empty values.

In the Flow, the Outbound Message is supposed to be triggered after the values have updated, however, I'm wondering, since it runs Asynchronously, perhaps it is firing before all the updates happen?

Would I have to run the Outbound Message asynchronously to be sure that all values have updated before it is sent?

2
  • the async path will run when the sync "path" is finished and the database committed. However, it will need to requery the product line items of the record-triggered flow's Opportunity
    – cropredy
    Commented Mar 29, 2023 at 21:07
  • Thank you. If you post that as an answer I can mark it as the answer. Commented Mar 29, 2023 at 21:10

1 Answer 1

2

The Async Path runs when the synchronous part of the flow is done and all database updates are committed. But any synchronous flow-created/updated variables (including record collection variables) aren't available to the asynchronous path.

You have to requery for those record collection variables (i.e. Opportunity Products) starting from $Record.Id within the asynchronous path.

Salesforce does not serialize the entire state of your synchronous path for use in the asynchronous path. The same is true for record-triggered flows with scheduled paths

2
  • Wait, this leads to a problem. In the Async branch I wanted to send an Outbound Message if StageName "IsChanged" equals "True". But if I re-fetch the Opportunity, I assume "IsChanged" is no longer true? It was updated in the other Synchronous branch of the Flow. Commented Apr 3, 2023 at 20:10
  • Then you might need a custom field on Opportunity - Is_Ready_For_Outbound_Message__c and set to true in the sync path and reset to false in the async path
    – cropredy
    Commented Apr 3, 2023 at 20:41

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .