Apex error in record-triggered flow

Last published at: 2024-07-15 14:32:26 UTC

If you get an error when running a record-triggered (apex) flow, stating
“An Apex error occurred: recordval.rv2Exception.CalloutException: Could not callout: You have uncommitted work pending. Please commit or rollback before calling out”, this means you ran the flow synchronously instead of asynchronously. 

When setting up the record-triggered flow, at “Optimizing the Flow for:”, select Actions and Related Records. Then, on the line below, make sure to tick the option Include a Run Asynchronously path to access an external system after the original transaction for the triggering record is successfully committed.