DML Error on new Asynchronous Record-Triggered Flow

We’ve recently developed a record triggered flow that retrieves data via callout when a certain field is set, using Salesforce’s new Asynchronous Record-Triggered Flow.

The issue we’re having is, that when we deploy the code and flow to prod from our partial sandbox (albeit, very outdated), we get the no-callouts-after-dml error. We did experience this slightly in our sandbox, but the issue went away (?!). The sandbox is pretty old, but we’ve tripple checked that no flows/PBs/apex triggers are fired (manually + nothing shows in the developer console logs) and committing any DML before our trigger below is fired. Even if there was DML being committed before, isn’t the whole point of this new asynchronous path to do exactly that: callout after dml?

error image

(We aren’t hitting any other limits – the Apex Action DMR Callout is just a callout in an @InvocableMethod)

I’d really like if we could get this solution up and running since no-code > code, but if we aren’t able to come up with a solution, we’ll just do 100% in apex with a @future apex function etc.

Our production org just switched to Winter 22′ – could it be a bug?
The API version of the flows are both 53

Thanks

Answer

As you mentioned the Flow is “Record-Triggered Flow” so it seems that the whole transaction starts with the Case DML.

I am assuming your @InvocableMethod is not calling any @future method and that’s why the error is occuring.

Please check also the similar problem here:
How do you invoke an external service in a flow triggered by a new Contact Creation?

Attribution
Source : Link , Question Author : Carl-Johan , Answer Author : Łukasz Kojzar

Leave a Comment