Section 4 · User Interface · 25% of exam
4.3 Flow, Visualforce, Apex Controllers, and Agentforce
Exam objective
Given a scenario, select a supported interface component and explain how Apex works with Lightning components, Flow, Visualforce, and Agentforce.
Interfaces
Choose an interface based on the task
Salesforce offers standard Lightning pages and components, Lightning Web Components, Aura components, Flow screens, and Visualforce. Start with the least custom option that satisfies the requirement. A record page with standard fields may need no code. A guided, multi-step user process can fit a screen Flow. A reusable interactive widget may justify an LWC. Visualforce remains relevant for existing applications, pages and extensions that use its framework, and specialized cases where its features fit. The presence of older Visualforce code is not itself a reason to rewrite it, but new functionality should follow current supported design patterns.
A screen Flow can ask for values, branch based on decisions, and perform supported record operations. If it needs a specialized calculation, a Flow can call invocable Apex with a collection-shaped interface. An LWC can launch a Flow or be embedded in supported Flow screens using the documented component interfaces. When comparing options, ask who initiates the process, whether it needs screen interaction, whether admins must adjust it, and whether one transaction or multiple stages are required.
Apex as a server-side service
A Lightning component can invoke an Apex method exposed with @AuraEnabled. The method should use an intentional input/output contract, validate record IDs and user-supplied values, apply the required security context, and return only fields needed by the interface. Read operations may be wired if the method is cacheable and read-only. Mutating operations are generally invoked imperatively, with the component showing progress, success, and failure states. Apex errors should be surfaced in a controlled way that helps the user without disclosing implementation details. Visualforce pages can use standard or custom controllers and controller extensions. A standard controller supplies common record behavior. A custom controller and its extension execute in system mode; a standard controller executes in user mode. An extension can add behavior while preserving standard controller capabilities, but its custom logic still needs deliberate access controls. A custom controller gives the page a bespoke model and actions, so the developer must implement more behavior and security. When a scenario asks whether to use a controller or extension, identify whether the page needs a standard record context plus additions or a completely custom interaction.
Connect actions to Agentforce thoughtfully
The exam guide includes Apex used with Agentforce among UI objectives. An Agentforce action may invoke a Flow, Apex, or another supported operation. Treat the agent's inputs as user-controlled requests: define action inputs and outputs clearly, validate them, enforce record access, and avoid broad operations that can modify arbitrary records. An agent's conversational interface does not grant permission to bypass Salesforce authorization. Actions should have a predictable scope, and consequential changes may need user confirmation or a review step according to the business process. A developer scenario can ask which part belongs in an agent, a Flow, a component, or Apex. Use the agent for natural-language interaction and routing, Flow for supported orchestration, Apex for bounded custom logic, and a UI component for explicit structured interaction. These pieces can work together, but every boundary should make the available records, actions, and errors clear.
Select and test the integration boundary
- Identify the UI surface and supported invocation mechanism. 2. Select a standard component, Flow, LWC, Aura, or Visualforce based on the experience. 3. Decide whether Apex adds necessary server logic or a custom transaction. 4. Define inputs, outputs, permissions, and error behavior. 5. Test with users who have different data access, including invalid inputs and unavailable records.
Salesforce product surfaces and Agentforce capabilities change. Use the exam guide to determine exam scope and current product documentation to verify which actions and interfaces are supported in a specific release.
Extra concept: API design at the UI boundary
A UI-facing Apex method is an API even when only one component calls it today. Stable names, explicit parameters, minimal return data, predictable errors, and server-enforced security make it safer to reuse from another component or Flow later.
Key takeaways
- Choose Flow for guided declarative interaction, LWC for custom Lightning components, and Visualforce for appropriate existing or specialized pages.
- Apex controllers and actions need explicit contracts, version-aware security, input validation, and controlled errors.
- Agentforce, Flow, Apex, and UI components can cooperate, but agent inputs do not replace authorization or human review.
- Official references:
- Salesforce Certified Platform Developer Exam Guide: https://help.salesforce.com/s/articleView?id=005298965&language=en_US&type=1
- LWC call Apex: https://developer.salesforce.com/docs/platform/lwc/guide/apex.html
- Visualforce classes and controllers: https://developer.salesforce.com/docs/platform/apex-dev/references/apex-dev/apex-pages.html
- Visualforce controller extensions: https://developer.salesforce.com/docs/platform/salesforce-pages-developers-guide/guide/pages-controller-extension.html
- Flow Builder: https://help.salesforce.com/s/articleView?id=sf.flow.htm&type=5
- Apex security for Lightning components: https://developer.salesforce.com/docs/platform/lwc/guide/apex-security
- Agentforce Vibes and agent development: https://developer.salesforce.com/docs/platform/agentforcevibes/guide/afv-agentdev-overview.html
