Imagine an AI-powered assistant in Salesforce that doesn’t just respond to questions, but guides your employees or customers through complex workflows with a smooth, intuitive interface. That’s the promise of Agentforce, Salesforce’s new AI Agent platform. But here’s the twist: the magic isn’t just in the AI models, it’s in how the data and user experience are structured. 

Lightning Types defines how inputs are captured, validated, and displayed in the Lightning Experience, from a simple date picker to a custom interactive slider. For developers, this means less time building UI boilerplate and more time focusing on the logic. For business leaders, it means faster deployment of intelligent, branded AI assistants that feel natural to use.

In this blog, we’ll break down:

  • What Lightning Types are and why they’re critical for Agentforce agents.
  • How their structure fits into the overall Agentforce architecture.
  • Real-world scenarios (healthcare, finance, retail) where they shine

By the end, you’ll see why Lightning Types aren’t just a developer feature; they’re the bridge between AI intelligence and user experience in Salesforce Agentforce.

Lightning Types in Agentforce Architecture

In practice, each Agentforce action (often backed by an Apex class) has input and output data that map to Lightning types. For instance, if your Apex action expects a Date, String, or Integer, Agentforce maps those to lightning__dateType, lightning__textType, and lightning__numberType respectively. Salesforce then automatically generates the appropriate UI. For example, a multi-line text input in Apex will render as a multi-line text editor (lightning__multilineTextType), and a date field will render as a date picker (lightning__dateType). When the action runs, the renderer shows outputs in a formatted way. For example, if an action returns a list of records (like flight results or account data), Agentforce can use the standard list type to display that list in a table. In the illustration below, an Agentforce action’s output is neatly rendered as a table of Accounts (name and phone) using the lightning__listType:

Lightning types automatically format outputs into a user-friendly UI. For example, a standard lightning__listType can render a list of Accounts (name and phone) in a responsive table view.

This automatic UI generation means you often don’t need to build your own forms – Agentforce handles it via Lightning types. However, for complex data or custom designs, you can create custom Lightning Types.

Custom Lightning Types with Lightning Web Components

Standard types are great for simple fields, but many real-world scenarios need custom UI. Salesforce lets you override the default UI by creating a LightningTypeBundle (available in API v64.0+). A LightningTypeBundle is a metadata bundle that lives in the lightningTypes/ folder of your project. Inside it you define: a schema.json (a JSON Schema for your data type), and optionally an editor.json and renderer.json to plug in custom Lightning Web Components for input and output.

For example, imagine a custom Lightning type called FlightFilter. Its schema.json would list fields like price and discountPercentage and their validation rules. You can then write an LWC (e.g. myFilterComponent) that collects those inputs in a polished way (sliders, pickers, etc.). In your editor.json, you reference this LWC using the $ key so Agentforce knows to use it instead of the default editors. Salesforce documentation shows this process step-by-step: for instance, it uses c/myFilterComponent in editor.json to override how the price and discountPercentage inputs are collected. You can even map LWC attributes to Apex fields with expressions like {!$attrs.price}.

Below is a simple LWC example (myFilterComponent) for the FlightFilter type. It presents a slider for Max Price and a number input for Max Discount. These fields match the FlightFilter Apex class (price and discountPercentage). In editor.json, you’d tie this component to the FlightFilter type (see next snippet).

<!– LWC Component: myFilterComponent.html (Flight filter inputs) –>

<template>

  <!– Slider for maximum price –>

  <lightning-slider label=”Max Price” min=”0″ max=”5000″ value={price} step=”10″ onchange={handlePriceChange}></lightning-slider>

  <!– Numeric input for maximum discount percentage –>

  <lightning-input type=”number” label=”Max Discount (%)” value={discountPercentage} onchange={handleDiscountChange} min=”0″ max=”100″ step=”1″></lightning-input>

</template>

 

// myFilterComponent.js

import { LightningElement, track } from ‘lwc’;

export default class MyFilterComponent extends LightningElement {

    @track price = 1000;

    @track discountPercentage = 10;

    handlePriceChange(event) {

        this.price = event.detail.value;

    }

    handleDiscountChange(event) {

        this.discountPercentage = event.target.value;

    }

    // This component is referenced in editor.json so Agentforce can read/write these fields.

}

 

In your LightningTypeBundle’s editor.json, you would link this component like so (JSON snippet):

{

  “$”: “c/myFilterComponent”,

  “attributes”: {

    “price”: “{!$attrs.price}”,

    “discountPercentage”: “{!$attrs.discountPercentage}”

  }

}

 This tells Agentforce to use myFilterComponent as the editor for the FlightFilter input type, and maps the component attributes to the Apex fields via {!$attrs.fieldName}. The same idea applies to renderer.json if you build a custom output LWC. (Use the “c/YourLwcName” prefix and attributes mapping to tie to your data.)

Real-World Use Cases for Lightning Types in Agentforce

1. Healthcare: Patient Appointment Scheduling

Imagine an Agentforce assistant helping patients book appointments. The agent asks for inputs like preferred date, time slot, and specialty.

  • Lightning Types Used:

    • lightning__dateType for selecting the appointment date.

    • lightning__picklistType for specialties (Cardiology, Pediatrics, etc.).

    • lightning__timeType for available time slots.

  • How it Works: The patient interacts with the assistant, which automatically generates a date picker and dropdowns for specialties and times. The results (available doctors with time slots) render in a lightning__listType table, showing doctor names, availability, and office locations.

Impact: Simplifies scheduling for patients while reducing call center volume for healthcare providers. Developers don’t need to build custom forms — Lightning Types handle the heavy lifting.

2. Financial Services: Loan Pre-Qualification Assistant

A banking Agentforce assistant guides customers through a loan pre-qualification process. Inputs include loan amount, annual income, and credit score range.

  • Lightning Types Used:

    • lightning__currencyType for loan amount.

    • lightning__numberType for income.

    • Custom Lightning Type CreditScoreFilter (with an LWC slider to choose a range, e.g., 600–850).

  • How it Works: The assistant displays a custom LWC slider for credit score (via a LightningTypeBundle), ensuring users provide clean, validated input. The backend runs calculations and outputs loan options (APR, monthly payment, eligibility) in a structured table format (lightning__listType).

Impact: Provides instant pre-qualification, enhances user experience, and builds customer trust — while developers only focus on Apex logic, since Lightning Types handle UI consistency.

3. Retail & E-Commerce: Personalized Product Finder

A retail company uses an Agentforce shopping assistant to help customers find products quickly. The assistant collects preferences such as category, budget, and color/style.

  • Lightning Types Used:

    • lightning__picklistType for categories (Shoes, Jackets, Electronics).

    • Custom Lightning Type BudgetRange with a slider LWC for min/max price.

    • lightning__multilineTextType for optional notes (“I need this for hiking”).

  • How it Works: The assistant displays a budget slider (custom LWC) and auto-generated picklists for categories and styles. Once inputs are provided, the assistant fetches products via Apex and renders them using a custom renderer LWC, showing images, prices, and “Add to Cart” buttons in a card layout.

Impact: Creates an interactive shopping experience that feels like a digital personal shopper, blending AI + Lightning Types + LWCs seamlessly.

 Recent Updates and Best Practices

Lightning Types and Agentforce are evolving rapidly. In recent releases (Summer ’25), Salesforce added a Setup view listing all Lightning Types in your org, making it easier to find and manage them. They also highlight custom Lightning types and LWCs as key to “more intuitive, user-friendly” agent UIs. Remember that LightningTypeBundle is a metadata component (deploy via Metadata API or Salesforce CLI), so include it in your source control. Use the namespace prefix (usually “c/”) when referencing your LWC components in the JSON configs. Stick to Lightning Experience for custom types (the Salesforce mobile app won’t render them)

Best practices: Favor standard types for simple fields (they come with ready-made UI and validation). Reserve custom Lightning types for complex data or UX needs (e.g. rich filters, rich results). Keep your schemas focused and validate inputs via schema.json. Limit how many actions and topics an agent has (per Agentforce limits) to maintain performance. Test your LWC inputs/outputs in a scratch org as you build the JSON, and use descriptive labels in schema.json. Finally, leverage packaging and CLI for smooth deployment – LightningTypeBundle works in unlocked and managed packages, so you can track it like any other metadata.

Key Takeaways

  • Lightning Types are JSON schemas for Agentforce actions that define data fields and UI. They let Salesforce auto-generate input forms and output displays in Lightning Experience.

  • Standard types (text, date, number, list, etc.) cover common use cases. For example, dates show a date-picker (lightning__dateType) and lists show tables (lightning__listType).

  • Custom Lightning Types use a LightningTypeBundle (schema, optional editor.json/renderer.json). You build LWC components (for input or output) and reference them in those JSON files.

  • In a flight-booking scenario, a custom filter component (with sliders and inputs) can collect search criteria, and custom or standard renderers can display results beautifully. Each code snippet (LWC + JSON) is carefully linked so Agentforce swaps in your UI.

  • Recent updates (Summer ’25) made managing Lightning Types easier via Setup and emphasized UI customization with LWCs. Always use API v64.0+ (supports LightningTypeBundle) and follow metadata deployment best practices.

By leveraging Lightning Types and LWCs, developers and architects can create highly customized, interactive Agentforce experiences that fit real-world business needs. These tools ensure your AI agents not only “think” correctly, but also look and feel right for your users.

#Salesforce #Agentforce #LightningTypes #LWCs #SalesforceDevelopers #SalesforceArchitect #SalesforceAI 

Leave a reply

Your email address will not be published. Required fields are marked *