Step-by-Step Guide to Customizing Agentforce Input UI with Custom Lightning Types
Here's how creating a Case through Agentforce usually goes. The service rep types something like "Log a high priority case for Edge Communications — machine MC 2030 won't start." The agent reads that sentence and the language model decides which words map to which fields: "high priority" becomes Priority, "Edge Communications" becomes the Account, the rest becomes the Subject and Description.
Most of the time it gets it right. But it's still guessing — it might match the wrong account, misplace a detail, skip a required field, or trip over a typo. And the rep can't see any of that before the case is saved.
The problem isn't the agent. It's the input. Free text is easy to type but ambiguous to interpret. The fix is to swap the messy text chat for a clean, interactive form. With Custom Lightning Types paired with a Lightning Web Component (LWC), you can make Agentforce render a proper "Case Information" panel right inside the chat — with three benefits:
Guided fields instead of typed commands. Pick the Account from a lookup, choose Priority from a dropdown, set dates with a date picker. No guessing, no spelling mistakes.
Validation in the chat. Check what the user entered — required fields, formats, valid values — before it reaches the Apex action.
Clean data mapping. Each field binds straight to the matching property in your Apex wrapper class, so what the user enters is exactly what gets saved.
And once the case is created, you can return a formatted confirmation card instead of a plain wall of text.
How It Works
A Custom Lightning Type is a data type you define to control how Agentforce renders data in the chat panel. It has two sides: an Editor (the form used to collect input) and a Renderer (the card used to display output). Each side wires to an LWC that draws the UI.
The build has three layers that all have to agree:
Apex defines the data contract. CaseInputController uses @InvocableVariable to declare every field, CaseFormLookupController handles Account and Contact lookups, and the createCase method inserts the Case and returns the result.
LWCs draw the UI. caseInputForm renders the form; caseResultRenderer renders the confirmation card. Each declares a target — lightning__AgentforceInput or lightning__AgentforceOutput — to appear in the chat panel.
Custom Lightning Types connect them. caseData points its Editor at caseInputForm; caseResult points its Renderer at caseResultRenderer.
The golden rule: field names must match exactly across all three layers. A mismatch won't throw an error — it just silently breaks the binding.
Why It Matters
When input is free text, accuracy depends on the model reading a sentence right every time. A form removes that variable. The account is a real record, the priority is always valid, required fields can't be skipped, and the user sees and corrects everything before the case is saved. Clean data, captured cleanly — and it's an object-agnostic pattern, so once you've done it for Cases you can point it at almost anything.
Step-by-Step Guide Overview
The full walkthrough builds the flow end to end:
Set up an Agentforce Developer Edition org.
Create a new Employee Agent in Agentforce Builder.
Create the Apex classes — CaseFormLookupController and CaseInputController.
Create the Custom Lightning Types — caseData (input) and caseResult (output).
Create and deploy the LWCs — caseInputForm and caseResultRenderer.
Assign each LWC to its Lightning Type via the Editor and Renderer overrides.
Create a custom Agent Action from createCase, wiring CaseData in and CaseResult out.
Add the action to your agent, then preview, commit, and activate.
Test it — open the panel, ask to create a case, fill the form, and watch the card render.
Summary
Custom Lightning Types let you control both ends of the Agentforce chat. On the way in, an Editor-backed type replaces ambiguous free text with a guided, validated form — data captured exactly, not interpreted. On the way out, a Renderer-backed type turns plain text into a clean card. Get the field names and targets right, and it renders natively inside the panel. Best of all, the pattern is reusable across almost any object.
Ready to try it? Work through the embedded guide in a Trial or Sandbox org, then adapt the pattern to another object like an Opportunity or Lead. For more hands-on builds, explore the full Mastering Agentforce series on the Academy.
References & Useful URLs
Salesforce Developer Documentation — Lightning Types: full editor and renderer example