Custom Lightning Types

Create custom Lightning types to customize the appearance of the UI for Agentforce (Default) in Lightning Experience. With custom Lightning types, you override the default user interface to manage complex interactions within Salesforce.

You can only override the default UI with a custom Lightning type for agent actions that use Apex classes as input or output.

To create custom lightning types in Salesforce, use the LightningTypeBundle metadata component. For information about how to create custom Lightning types, see LightningTypeBundle Metadata API.

Benefits:

  • Enhanced UI Customization

    Standard Lightning types have predefined UI components. However, they don’t always fit your design needs or the user experience. Custom Lightning types give you full control over the UI. You can create tailored components that match your specific styling and behavior requirements. This customization ensures that the interface looks and functions exactly as you need for your application.

  • Handling Complex Data Structures

    Standard Lightning types sometimes can’t handle complex data, but custom Lightning types can manage and render complex data structures. For example, they can handle deeply nested objects, complex arrays, and dynamic fields that change based on user input. With custom Lightning types, you can build UIs that display complex data smoothly. Customize your UI to handle complex data structures, and you ensure that your Salesforce actions can accommodate even the most detailed and dynamic workflows.

These screenshots demonstrate the improvements in the agent action output UI achieved through custom Lightning types.

The default UI for output in an agent actionThe customized UI for output in an agent action
Agent's response to a flight details request, with no labels, a cluttered and unappealing layout, and no "Book Now" button.Agent's response to a flight details request, featuring clear labels, an appealing layout, a highlighted discount, and a prominent "Book Now" button.

The LightningTypeBundle metadata type describes the custom Lightning types. It’s available in API version 64.0 and later.

To get a list of the custom and standard Lightning types deployed in your org, make a call to the connect/lightning-types resource.

For more information about the resources available in the Type System Connect REST API, see the Type System Resources.

LightningTypeBundle components are stored in the lightningTypes folder.

Here’s an example of the LightningTypeBundle structure.

The bundle includes these resources.

  • The lightningTypes folder (1) contains a folder for each custom Lightning type created in the format TypeName (2).
  • Each custom Lightning type folder contains a schema.json file (3) that defines the JSON schema that drives the custom Lightning type validation.
  • If applicable, the custom Lightning type folder also contains a lightningDesktopGenAi folder (4) with two files that indicate the optional artifacts needed for the lightningDesktopGenAi channel. Configure these files to override the default UI of a custom Lightning type when it’s used in an agent action.
    • The editor.json file (5) has custom user interface and editor information.
    • The renderer.json file (6) has custom user interface and renderer information.

To deploy a LightningTypeBundle to your Salesforce org, use Metadata API. The Metadata API uses a manifest file that defines the metadata that you want to deploy.

Here’s an example package.xml manifest file for a LightningTypeBundle that includes the custom Lightning type myFlight.

To delete a custom Lightning type, you must deploy a destructiveChanges package to your org that lists the types to delete.

See Also

For details on each configuration file type, review these topics.