Invocable Apex in Flows and Custom Metadata SOQL limits?

Say we have a record-triggered flow that calls invocable Apex. The Apex class uses SOQL to query custom metadata and return a value to the flow. Does the Apex custom metadata query count against the SOQL limits for the Flow transaction?

This article says that Apex does not consume SOQL queries when retrieving Custom Metadata, but "SOQL queries for custom metadata type records in flows" do count against the limit: https://help.salesforce.com/articleView?id=sf.custommetadatatypes_limits.htm&type=5

Is the invocable Apex considered a "SOQL query in the flow"?

I know I could write this entirely in Apex instead of a Flow/Apex hybrid, but the client wants to use Flow as much as possible.

I've opened a case with Salesforce but was wondering if anyone has run into this already.

Answers 1

  • CMDT Queries performed in Apex do not count against the limit. They are specifically referencing queries performed by Get Records. I actually did take the time to test this, as @cropredy suggested, and successfully performed 1000 CMDT queries in a single Apex Action without a problem.


Related Questions