Newer Version Available

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

$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

1<apex:page >
2    <script>
3    // Load the MessageChannel token in a variable
4    var SAMPLEMC = "{!$MessageChannel.SampleMessageChannel__c}";
5    function handleClick() {
6        const payload = {
7            recordId: "some string",
8            recordData: {value: "some value"}
9        }
10        sforce.one.publish(SAMPLEMC, payload);
11      }
12    </script>
13    <div>
14    <p>Publish SampleMessageChannel</p>
15    <button onclick="handleClick()">Publish</button>
16    </div>
17</apex:page>