# Apex for page components: controllers and wire adapters

*Platform Developer Study Guide · User Interface · Last updated October 15, 2026 · https://www.certifyforce.com/study-guide/platform-developer/user-interface/apex-for-page-components-controllers-wire*

Which Apex contract each page component needs: @AuraEnabled methods called by wire or imperatively from Lightning web components, cacheable=true and refreshApex, AuraHandledException errors, @InvocableMethod actions shared by Flow and Agentforce, and Visualforce standard, list, custom and extension controllers.

- Certification: Salesforce Platform Developer
- Exam section: User Interface
- Study guide: https://www.certifyforce.com/study-guide/platform-developer

**Official exam objective:**

> Given a scenario, implement Apex to work with various types of page components, including Lightning components, Flow, and Agentforce.

## What the exam expects

- Expose an Apex method to a Lightning web component and choose between `@wire` and an imperative call.
- Explain what `cacheable=true` allows and forbids, and refresh stale wired data with `refreshApex()`.
- Return controlled errors from Apex with `AuraHandledException` and handle them in the component.
- Write one `@InvocableMethod` that a flow and an Agentforce agent can both call, with clear labels and a bulk-safe signature.
- Pick the Visualforce controller type: standard, standard list, custom or extension.

Key terms: **`@AuraEnabled`** (the annotation that exposes a static Apex method to Lightning components), **cacheable method** (a read-only `@AuraEnabled` method whose results the client caches), **imperative call** (a promise-returning call your code triggers), **invocable action** (an `@InvocableMethod` that Flow, agents and REST can run), **controller extension** (an Apex class that extends a standard or custom Visualforce controller).

## Key facts

| Fact | Detail | Source |
|---|---|---|
| LWC-callable Apex | `static`, `public` or `global`, `@AuraEnabled` | [Expose Apex Methods](https://developer.salesforce.com/docs/platform/lwc/guide/apex-expose-method.html) |
| Overloads | Not allowed on `@AuraEnabled` methods from API 55.0 | [AuraEnabled Annotation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_AuraEnabled.htm) |
| `@wire` to Apex | Requires `cacheable=true`; the method can't change data | [Client-Side Caching](https://developer.salesforce.com/docs/platform/lwc/guide/apex-result-caching.html) |
| Stale wired Apex data | `refreshApex()` with the wire-emitted value | [Client-Side Caching](https://developer.salesforce.com/docs/platform/lwc/guide/apex-result-caching.html) |
| Wrapper serialization | Only `@AuraEnabled` members are returned | [Returning Data from Apex](https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_apex_returning_data.htm) |
| Friendly errors | Throw `AuraHandledException` instead of a raw system exception | [Returning Errors from Apex](https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_apex_custom_errors.htm) |
| Invocable per class | One method; only `@Deprecated` may accompany it | [InvocableMethod Annotation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm) |
| Invocable input and output | At most one List parameter; outputs match inputs in size and order | [InvocableMethod Annotation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm) |
| Agent action metadata | Method and variable labels and descriptions become the action's defaults | [Agentforce Apex Actions](https://developer.salesforce.com/blogs/2025/05/best-practices-for-building-agentforce-apex-actions) |
| List controller page size | 20 records by default | [Pagination with a List Controller](https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_pagination.htm) |
| Custom controllers and extensions | Run in system mode; standard controller logic runs in user mode | [Custom Controllers and Extensions](https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_def.htm) |

## Check yourself

- Why can't a method that updates records be wired?
- When does a component need `refreshApex()`?
- Why label and describe an invocable method used as an agent action?
- Which Visualforce controller pages Opportunities 20 at a time with little Apex?

## Sources

- [Call Apex Methods](https://developer.salesforce.com/docs/platform/lwc/guide/apex.html)
- [Expose Apex Methods to Lightning Web Components](https://developer.salesforce.com/docs/platform/lwc/guide/apex-expose-method.html)
- [Wire Apex Methods to Lightning Web Components](https://developer.salesforce.com/docs/platform/lwc/guide/apex-wire-method.html)
- [Call Apex Methods Imperatively](https://developer.salesforce.com/docs/platform/lwc/guide/apex-call-imperative.html)
- [Client-Side Caching of Apex Method Results](https://developer.salesforce.com/docs/platform/lwc/guide/apex-result-caching.html)
- [Handle Errors in Lightning Data Service](https://developer.salesforce.com/docs/platform/lwc/guide/data-error.html)
- [AuraEnabled Annotation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_AuraEnabled.htm)
- [Returning Errors from an Apex Server-Side Controller](https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_apex_custom_errors.htm)
- [Returning Data from an Apex Server-Side Controller](https://developer.salesforce.com/docs/atlas.en-us.lightning.meta/lightning/controllers_server_apex_returning_data.htm)
- [InvocableMethod Annotation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableMethod.htm)
- [InvocableVariable Annotation](https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_classes_annotation_InvocableVariable.htm)
- [Create Custom Actions Using Apex InvocableMethod](https://developer.salesforce.com/docs/ai/agentforce/guide/agent-invocablemethod.html)
- [Best Practices for Building Agentforce Apex Actions](https://developer.salesforce.com/blogs/2025/05/best-practices-for-building-agentforce-apex-actions)
- [Custom Controllers and Controller Extensions](https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller.htm)
- [What are Custom Controllers and Controller Extensions?](https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_def.htm)
- [Standard Controllers](https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_std.htm)
- [Standard List Controllers](https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_about.htm)
- [Pagination with a List Controller](https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_sosc_pagination.htm)
- [Building a Controller Extension](https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_extension.htm)
- [Build a Custom Controller](https://developer.salesforce.com/docs/atlas.en-us.pages.meta/pages/pages_controller_custom.htm)

## About the full unit

The "Core concepts", "Exam traps" and "Worked scenario" sections of this unit, its 20 linked practice questions, and unlimited timed mock exams are included with the Platform Developer pack (USD $19): https://www.certifyforce.com/practice-exams
