Salesforce Dictionary - Free Salesforce GlossarySalesforce Dictionary
Salesforce Developer
medium

What is `@AuraEnabled` and how does it differ from `@InvocableMethod`?

Both annotations expose Apex to non-Apex callers, but they target different consumers.

`@AuraEnabled` — exposes Apex to Lightning components (Aura and LWC).

apex @AuraEnabled(cacheable=true) public static List<Account> getAccounts() { ... }

LWC: import getAccounts from '@salesforce/apex/AccountController.getAccounts'; then bind with @wire. cacheable=true allows client-side caching (required for @wire).

`@InvocableMethod` — exposes Apex to Flow Builder as a callable Apex Action.

apex @InvocableMethod(label='Get Accounts') public static List<List<Account>> getAccounts(List<Id> accountIds) { ... }

Bulk pattern is mandatory: List in, List out.

Differences: caller (LWC vs Flow), bulk (single vs list), caching (cacheable=true vs N/A), discovery (import vs Action element). You can have both annotations on the same method.

Why this answer works

Tests cross-tool fluency. The bulk-input requirement for InvocableMethod and the cacheable=true for wire are senior signals.

Follow-ups to expect

Related dictionary terms