Newer Version Available

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

LightningMessageChannel

Represents the metadata associated with a Lightning Message Channel. A Lightning Message Channel represents a secure channel to communicate across UI technologies (Lightning Web Components, Aura Components, and Visualforce). This type extends the Metadata metadata type and inherits its fullName field.

Where possible, we changed noninclusive terms to align with our company value of Equality. Because changing terms in our code can break current implementations, we maintained this metadata type’s name.

Important

File Suffix and Directory Location

LightningMessageChannel components have the suffix .messageChannel and are stored in the messageChannels folder.

Version

LightningMessageChannel components are available in API version 47.0 and later.

Fields

Field Name Field Type Description
description string The description of the Lightning Message Channel.
isExposed boolean Indicates whether a Lightning Message Channel is exposed to components in other namespaces (true) or not (false). The default value is false. If you set isExposed to true on a Message Channel that is in a managed package or referenced by another Message Channel component, you cannot change it to false. Other orgs or components already rely on your Message Channel, which can cause their code to break.
lightningMessageFields LightningMessageField[] A list of message payload fields for a given Lightning Message Channel.
masterLabel string Required. The label for a Lightning Message Channel.

LightningMessageField

Represents a message payload field for a given Lightning Message Channel.

Field Name Field Type Description
description string The description for a Lightning Message Field.
fieldName string Required. Unique identifier of the Lightning Message Field.

Declarative Metadata Sample Definition

Here’s a simple example of a LightningMessageChannel component.

1<?xml version="1.0" encoding="UTF-8"?>
2<LightningMessageChannel xmlns="http://soap.sforce.com/2006/04/metadata">
3    <masterLabel>SampleMessageChannel</masterLabel>
4    <isExposed>true</isExposed>
5    <description>This is a sample Lightning Message Channel.</description>
6</LightningMessageChannel>

The following is an example of a LightningMessageChannel component with LightningMessageFields.

1<?xml version="1.0" encoding="UTF-8"?>
2<LightningMessageChannel xmlns="http://soap.sforce.com/2006/04/metadata">
3    <masterLabel>SampleMessageChannel</masterLabel>
4    <isExposed>true</isExposed>
5    <description>This is a sample Lightning Message Channel.</description>
6    <lightningMessageFields>
7        <fieldName>recordId</fieldName>
8        <description>This is the record Id that changed</description>
9    </lightningMessageFields>
10    <lightningMessageFields>
11        <fieldName>recordData</fieldName>
12        <description>The current data representing the record that changed</description>
13    </lightningMessageFields>
14</LightningMessageChannel>

The following is an example package.xml that references the previous definition.

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>LightningMessageChannel</name>
6    </types>
7    <version>47.0</version>
8</Package>

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.