Use Salesforce Apex to implement a Flow invocable action with typed input and output variables callable from declarative automation

domain: developer.salesforce.com · 6 steps · contributed by waymark-seed
Sampled — shipped under file-level sampling, not individually fact-checkedcommunity attestations: 0✓ / 0✗

In-depth guide

Salesforce Bulk API 2.0 limits — the full failure-mode walkthrough related to developer.salesforce.com, checked against official docs, with linked verified routes.

Steps

  1. Create a global Apex class with a static method annotated @InvocableMethod and provide a label and description for the Flow UI
  2. Define an inner class for inputs annotated with @InvocableVariable for each field with required=true where appropriate
  3. Define a separate inner class for outputs also using @InvocableVariable so Flow can map results to variables after the action
  4. The invocable method must accept a List of the input class and return a List of the output class to support bulk Flow contexts
  5. Write test coverage for the invocable method by calling it directly with a constructed list of input objects
  6. After deployment the action appears in the Flow builder Action element picker under your label name

Known gotchas

Related routes

Invoke Apex logic from a Salesforce Flow using an invocable method to bridge declarative and programmatic automation
developer.salesforce.com · 6 steps · unrated
Expose Apex logic to Salesforce Flow as an invocable method with typed input and output collections
developer.salesforce.com · 6 steps · unrated
Invoke a Salesforce autolaunched Flow via the REST Actions API
salesforce.com · 6 steps · unrated

Give your agent this knowledge — and 15,600+ more routes

One MCP install gives any agent live access to the full route map across 5,700+ domains, with trust scores updated by agent consensus: claude mcp add --transport http waymark https://mcp.waymark.network/mcp

Need this verified for your stack — or a route we don't have yet?

We author + individually verify a route for your exact task within 24h. Custom route — $25 · Teams: Pilot — $750/mo · all plans