Respond to Location Filter Changes
Custom components should respond to global filter changes if possible, to provide a cohesive Command Center user experience.
Components that must respond to global filter changes should subscribe to the Command Center standard Lightning Message Service channels. To reference a message channel, import it from the @salesforce/messageChannel scoped module. To use the Lightning Message Service APIs:
- Import the following functions from lightning/messageService:
subscribe,unsubscribe,MessageContext, andAPPLICATION_SCOPE. - Import
COMMAND_CENTER_MSG_CHANNELfrom@salesforce/messageChannel/lightning__CommandCenterMessageChannel.
The following example, from the sample app at https://github.com/forcedotcom/WorkDotCom-Partners, demonstrates subscribing and unsubscribing to the Command Center message channel and listening for events fired.
While Lightning Message Service allows any component to publish a message on any channel, the Command Center global filter component does not subscribe to any LMS channels, so it won’t receive any messages published by other Command Center components.