Create a Message Channel
To create a Lightning message channel, use the LightningMessageChannel metadata type.
To deploy a LightningMessageChannel into your org, create an SFDX project. Include the XML definition in the force-app/main/default/messageChannels/
directory. The LightningMessageChannel file name follows the format messageChannelName.messageChannel-meta.xml
.
To add it to your scratch org, run sf project deploy start
.
To add it to another type of org, such as a sandbox or a Developer Edition org, run sf project deploy start
.
Here’s how to import a Lightning message channel that a component can use to communicate via the Lightning Message Service.
channelName
—An imported symbol that identifies the message channel.channelReference
—The API name of the message channel.namespace
—If the message channel is in a managed package, this value is the namespace of the managed package. If the message channel is not in a managed package, do not include a namespace.
Record_Selected__c
refers to a custom instance of the LightningMessageChannel metadata type. Although it uses the __c
suffix, it isn’t a custom object.
See Also