LightningMessageChannel

Represents the metadata associated with a Lightning Message Channel. A Lightning Message Channel represents a secure channel to communicate across UI technologies, such as 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. We maintained certain terms to avoid any effect on customer implementations.

Important

Before you include a Lightning Message Channel in a managed package, review these considerations.

  • To pass the AppExchange Security Review, you must set the isExposed field to false.
  • If you set the isExposed field to true, you can’t change the value to false at a later time. This consideration applies to Lightning Message Channels in managed packages and Lightning Message Channels that other components reference.
  • Visualforce supports only Lightning Message Channels where isExposed is true, so managed packages with a Lightning Message Channel in Visualforce can’t pass the AppExchange Security Review. See Considerations and Limitations in the Visualforce Developer Guide.

Note

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.
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.

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

Here’s an example of a LightningMessageChannel component with LightningMessageFields.

<?xml version="1.0" encoding="UTF-8"?>
<LightningMessageChannel xmlns="http://soap.sforce.com/2006/04/metadata">
    <masterLabel>SampleMessageChannel</masterLabel>
    <isExposed>true</isExposed>
    <description>This is a sample Lightning Message Channel.</description>
    <lightningMessageFields>
        <fieldName>recordId</fieldName>
        <description>This is the record Id that changed</description>
    </lightningMessageFields>
    <lightningMessageFields>
        <fieldName>recordData</fieldName>
        <description>The current data representing the record that changed</description>
    </lightningMessageFields>
</LightningMessageChannel>

Here’s an example package.xml that references the previous definition.

<?xml version="1.0" encoding="UTF-8"?>
<Package xmlns="http://soap.sforce.com/2006/04/metadata">
    <types>
        <members>*</members>
        <name>LightningMessageChannel</name>
    </types>
    <version>47.0</version>
</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.