Newer Version Available

This content describes an older version of this product. View Latest

LightningTypeBundle

Represents a custom Lightning type. Use this type to override the default user interface to create a customized appearance of responses on the custom agent’s action input and output. 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 the Metadata metadata type and inherits its fullName field.

File Structure 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        +--TypeName (2)
4           +--schema.json (3)
5           +--lightningDesktopGenAi (4)
6              +--editor.json (5) OR +--renderer.json (6)

The bundle includes the following 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.
  • 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.

Version

LightningTypeBundle components are available in API version 64.0 and later.

Fields

Field Name Description
description
Field Type
string
Description
Describes the lightning type.
masterLabel
Field Type
string
Description

Required. Represents the name of a LightningTypeBundle which is defined when the LightningTypeBundle is created.

resources
Field Type
LightningTypeBundleResource[]
Description
The list of resource files in the lightningTypes folder.

LightningTypeBundleResource

Represents a resource inside a LightningTypeBundle.

Field Name Description
fileName
Field Type
string
Description

Required. Name of the resource file.

filePath
Field Type
string
Description

Required. Path of the resource file.

source
Field Type
base64Binary
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.