When a greeter changes the service territory in the Lobby Management dashboard,
Salesforce Scheduler publishes a Lightning Message Service (LMS) event on the
lightning__appointmentBooking_greeterDashboard channel. Subscribe from a
custom Lightning web component or Aura component to keep custom waitlists, appointments, or
data views in sync with the selected territory.
Required Editions
| Available in: Lightning Experience. |
| Available in: Enterprise and Unlimited Editions |
Channel
| Channel Name | lightning__appointmentBooking_greeterDashboard |
| Scope | APPLICATION |
| Exposure | External. The channel is available across namespaces and to customer code that runs on the platform. |
Message Payload
| Property | Data Type | Details |
|---|---|---|
eventType |
String | The type of dashboard event. For example,
TERRITORY_CHANGE.
|
eventData |
Object | Data specific to the event. The internal structure depends on the
eventType.
|
Lightning Web Component Example
To listen to the lightning__appointmentBooking_greeterDashboard event,
import the Lightning Message Service features from
lightning/messageService and pass the channel reference to the
subscribe() method.
import { LightningElement, wire } from 'lwc';
import {
subscribe,
unsubscribe,
APPLICATION_SCOPE,
MessageContext
} from 'lightning/messageService';
import GreeterDashboardChannel from '@salesforce/messageChannel/lightning__appointmentBooking_greeterDashboard';
export default class GreeterDashboardExample extends LightningElement {
subscription = null;
eventType;
eventData;
@wire(MessageContext)
messageContext;
connectedCallback() {
this.subscribeToMessageChannel();
}
subscribeToMessageChannel() {
if (!this.subscription) {
this.subscription = subscribe(
this.messageContext,
GreeterDashboardChannel,
(message) => this.handleMessage(message),
{ scope: APPLICATION_SCOPE }
);
}
}
handleMessage(message) {
const { eventType, eventData } = message;
if (eventType === 'TERRITORY_CHANGE') {
console.log('Territory changed:', eventData);
}
}
}
Aura Component Example
In the component markup, declare the message channel.
<lightning:messageChannel type="lightning__appointmentBooking_greeterDashboard"
scope="APPLICATION"
onMessage="{!c.onGreeterDashboardMessage}" />
In the controller, handle the message.
({
onGreeterDashboardMessage: function(cmp, evt, helper) {
var eventType = evt.getParam('eventType');
var eventData = evt.getParam('eventData');
if (eventType === 'TERRITORY_CHANGE') {
console.log("Territory changed:", JSON.stringify(eventData));
}
}
})