$MessageChannel

A global merge field type to provide access to a message channel defined in your organization.

Usage

Use this expression in your Visualforce page to access a message channel and use the Lightning Message Service APIs.

Examples

<apex:page>
    <script>
        // Load the MessageChannel token in a variable
        var SAMPLEMC = "{!$MessageChannel.SampleMessageChannel__c}";
        function handleClick() {
            const payload = {
                recordId: "some string",
                recordData: {value: "some value"}
            }
            sforce.one.publish(SAMPLEMC, payload);
        }
    </script>
    <div>
        <p>Publish SampleMessageChannel</p>
        <button onclick="handleClick()">Publish</button>
    </div>
</apex:page>