Apex · Flow
Research draft · Response not yet published
Why won’t my Apex InvocableMethod class compile?
A beginner’s invocable Apex class fails to save with an unexpected annotation token error. This is a small compiler problem to isolate before building the full action.
This page is a starting point for my own investigation. It does not yet provide a tested solution.
Read the original community question ↗Already answered; the author confirmed the syntax fix. Use this as a reproduction exercise, and add a community answer only if it contributes new tested detail.
What I’ll investigate
- Reproduce only the annotation error in a sandbox using a minimal method.
- Compare the label and description syntax with the official examples, then address any remaining return-type or output-variable errors separately.
Research notes
Reading notes checked on 5 December 2026. Org testing is still pending.
Reading note: Salesforce’s InvocableMethod reference documents the annotation modifiers and method signature restrictions. Start with a minimal valid class and compare its annotation to the failing example. This note is based on documentation, not an org test.
My response
I haven’t written my response yet. After testing, I’ll explain the cause, the smallest fix, and how I verified it, then credit the original question and any answers I build on.
Solution or simplified workaround
Pending validation. I’ll explain when to use it, the smallest steps, the expected result, limitations, and how to undo it.
Validation
Not yet tested. I’ll record the actual results after reproducing the issue.
- The minimal class compiles.
- The action appears in Flow Builder for a user with class access.
- A small test verifies the method’s actual return value.
Possible next step
Start with a short annotated example and blog post; no app is needed.