LightningTypeBundle

Represents a custom Lightning type. Use this type to override the default user interface to create a customized appearance based on your business requirements. Deploy this bundle to your organization to implement the overrides.

Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

Important

Parent Type 

This type extends Metadata and inherits its fields.

File Suffix and Directory Location 

LightningTypeBundle components are stored in the lightningTypes folder.

Here’s an example of the LightningTypeBundle structure.

1+--myMetadataPackage
2    +--lightningTypes (1)
3        +--TYPE_NAME (2)
4           +--schema.json (3)
5           +--CHANNEL_NAME (4)
6              +--editor.json (5) OR +--renderer.json (6)

The bundle includes these resources.

  • The lightningTypes folder (1) contains a folder for each created custom Lightning type 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.
  • Optional channel-specific folders (4). To override the default UI for a specific Salesforce application, the bundle contains a folder named after that channel. The supported channel folders are:
    • lightningDesktopGenAi (Agentforce Employee agent in Lightning Experience)
    • enhancedWebChat (Agentforce Service agent via Enhanced Chat v2)
    • lightningMobileGenAi (Agentforce Employee agent on Mobile and Agentforce Service agent via Enhanced Chat v2 on Mobile)
    • experienceBuilder (Experience Builder)
    Inside the {channelName} folder, you can configure:
    • The editor.json file (5) containing custom user interface and editor information
    • The renderer.json file (6) containing custom user interface and renderer information

      Note: This file isn’t supported in experienceBuilder.

Version 

Introduced in API version 64.0.

Fields 

description 

  • Type: string
  • Required: No
  • Description: Describes the lightning type.

masterLabel 

  • Type: string
  • Required: Yes
  • Description: Required. Represents the name of a LightningTypeBundle which is defined when the LightningTypeBundle is created.

resources 

LightningTypeBundleResource Type 

Represents a resource inside a LightningTypeBundle.

Fields 

fileName 

  • Type: string
  • Required: Yes
  • Description: Required. Name of the resource file.

filePath 

  • Type: string
  • Required: Yes
  • Description: Required. Path of the resource file.

fileType 

  • Type: string
  • Required: Yes

source 

  • Type: base64Binary
  • Required: Yes
  • Description: Required. The JSON content of the resource.

Declarative Metadata Sample Definition 

This package.xml file retrieves all the LightningTypeBundle components in an org.

1<?xml version="1.0" encoding="UTF-8"?>
2<Package xmlns="http://soap.sforce.com/2006/04/metadata">
3    <types>
4        <members>*</members>
5        <name>LightningTypeBundle</name>
6    </types>
7    <version>64.0</version>
8</Package>

In the retrieved .zip file, each custom Lightning type is nested under a lightningTypes folder.

This example shows the directory structure in the .zip file of a custom Lightning type named flightResponse:

1+--lightningTypes
2    +--flightResponse
3        +--schema.json
4        +--lightningDesktopGenAi
5            +--renderer.json

In this example, the custom Lightning type flightResponse is a complex type that references an Apex class named Flight.

1global class Flight {
2
3    @AuraEnabled
4    global String flightId;
5
6    @AuraEnabled
7    global Integer numLayovers;
8
9    @AuraEnabled
10    global Boolean isPetAllowed;
11
12    @AuraEnabled
13    global Long price;
14
15    @AuraEnabled
16    global Double discountPercentage;
17
18    @AuraEnabled
19    global Integer durationInMin;
20
21    global Flight(String flightId, Integer numLayovers, Boolean isPetAllowed,
22                  Long price, Double discountPercentage, Integer durationInMin) {
23        this.flightId = flightId;
24        this.numLayovers = numLayovers;
25        this.isPetAllowed = isPetAllowed;
26        this.price = price;
27        this.discountPercentage = discountPercentage;
28        this.durationInMin = durationInMin;
29     }
30}
31global class FlightRequestFilter {
32
33    @AuraEnabled
34    global Long price;
35
36    @AuraEnabled
37    global Double discountPercentage;
38}

Here are the contents of the files in the flightResponse directory. This sample code shows the contents of the schema.json file.

1{
2  "title": "My Flight Response",
3  "description": "My Flight Response",
4  "lightning:type": "@apexClassType/c__Flight"
5}

The lightningDesktopGenAi folder (optional) includes a renderer.json file that overrides the default UI of the custom Lightning type flightResponse when you use the Flight Apex class as an output parameter for an agent action.

Contents of the renderer.json file.

1{
2  "renderer": {
3    "componentOverrides": {
4      "$": {
5        "definition": "c/flightDetails"
6      }
7    }
8  }
9}

flightDetails is a custom LWC component referenced in renderer.json file.

Note

This example shows the directory structure in the .zip file of a custom Lightning type named flightFilter:

1+--lightningTypes
2    +--flightFilter
3        +--schema.json
4        +--lightningDesktopGenAi
5            +--editor.json

In this example, the custom Lightning type flightFilter is a complex type that references an Apex class named FlightRequestFilter.

1global class Flight {
2
3    @AuraEnabled
4    global String flightId;
5
6    @AuraEnabled
7    global Integer numLayovers;
8
9    @AuraEnabled
10    global Boolean isPetAllowed;
11
12    @AuraEnabled
13    global Long price;
14
15    @AuraEnabled
16    global Double discountPercentage;
17
18    @AuraEnabled
19    global Integer durationInMin;
20
21    global Flight(String flightId, Integer numLayovers, Boolean isPetAllowed,
22                  Long price, Double discountPercentage, Integer durationInMin) {
23        this.flightId = flightId;
24        this.numLayovers = numLayovers;
25        this.isPetAllowed = isPetAllowed;
26        this.price = price;
27        this.discountPercentage = discountPercentage;
28        this.durationInMin = durationInMin;
29     }
30}
31global class FlightRequestFilter {
32
33    @AuraEnabled
34    global Long price;
35
36    @AuraEnabled
37    global Double discountPercentage;
38}

Here are the contents of the files in the flightFilter directory. This sample code shows the contents of the schema.json file.

1{
2  "title": "Flight Filter",
3  "description": "Flight Filter",
4  "lightning:type": "@apexClassType/c__FlightRequestFilter"
5}

The lightningDesktopGenAi folder (optional) includes an editor.json file that overrides the default UI of the custom Lightning type flightFilter when you use the Flight Apex class as an input parameter for an agent action.

Contents of the editor.json file.

1{
2  "editor": {
3    "componentOverrides": {
4      "$": {
5        "definition": "c/flightFilter"
6      }
7    }
8  }
9}

flightFilter is a custom LWC component referenced in editor.json file.

Note

Wildcard Support in the Manifest File 

This metadata type supports the wildcard character * (asterisk) in the package.xml manifest file. For information about using the manifest file, see Deploying and Retrieving Metadata with the Zip File.