User Interface20% of the exam

Calling Apex from LWC and Aura components

How to read an LWC or Aura component and its Apex controller and spot the fix: cacheable wires versus imperative calls, reactive parameters and undefined values, refreshApex, immutable wired data, the Aura server-action lifecycle and the @AuraEnabled rules for methods and wrapper classes.

Official exam objective
Given requirements and code snippets for a LWC or Aura Component and its Apex controller class, analyze determine any changes.

~8 min read · 11 practice questions ·

What the exam expects

  • Read an LWC and its Apex method and decide whether the call must be wired or imperative, and what annotation the method needs.
  • Spot parameter mistakes: a bare value instead of a parameter object, a missing $, or an undefined reactive value that stops the wire.
  • Refresh wired Apex data correctly with refreshApex() and change provisioned data without mutating it.
  • Fix an Aura client-side controller that never reaches the server, or whose attribute change made outside the framework never rerenders.
  • Apply the @AuraEnabled rules for static methods, wrapper-class properties, unique action names and overloads.

Key terms: cacheable method (an @AuraEnabled(cacheable=true) method that only reads, required for @wire), reactive parameter (a $-prefixed wire parameter bound to a component property), wire-emitted value (the object the wire service provisions, which refreshApex() takes), server-side action (an Aura action created with component.get("c.method")), $A.getCallback() (the wrapper that brings code back into the Aura lifecycle).

The PD I basics (exposing methods, wire versus imperative in general, AuraHandledException) are in the Platform Developer guide's Apex for page components: controllers and wire adapters; this unit is the code-reading layer on top.

Key facts

@wire to Apex
Detail
Method must be @AuraEnabled(cacheable=true), static, public or global
Cacheable methods
Detail
May only get data, never change it
Insert, update, delete
Detail
Must be called imperatively
Parameters
Detail
An object whose properties match the Apex parameter names; Maps unsupported
Wire parameter undefined
Detail
Method isn't called; null calls it
refreshApex() argument
Detail
An object previously emitted by an Apex @wire
Provisioned Apex data
Detail
Treat as immutable; shallow-copy to change
Aura action send
Detail
$A.enqueueAction(action) queues it; batched at end of event loop
Aura callback states
Detail
SUCCESS, ERROR, INCOMPLETE (ABORTED deprecated)
setTimeout() in Aura
Detail
Wrap in $A.getCallback() so the component rerenders
Wrapper serialization
Detail
Only @AuraEnabled public instance members are returned
Overloads
Detail
Not allowed on @AuraEnabled methods from API 55.0
Sources for this section (9)
  • Why does a wired Apex method that inserts records violate the platform's rules?
  • When does a wire with a `$` parameter skip calling Apex?
  • When does Aura code need `$A.getCallback()`?
  • Which wrapper-class members reach the component?

The questions are free to read. Answers with their sources and self-grading are included with the pack.

Keep reading with the Platform Developer II pack

  • Core concepts
  • Exam traps
  • Worked scenario

The pack includes:

  • All 28 lessons of the Platform Developer II guide, with reading progress
  • Interactive decision walks and step-by-step sequence steppers
  • Inline practice questions and one-click topic practice (11 questions for this lesson)
  • An official source cited for every claim
  • An AI tutor that answers from the guide
  • Unlimited timed practice exams

Practice for the Platform Developer II exam