We can make use of lightning:omniChannelStatusChanged event to listen Salesforce Omni-Channel Presence Status changes by the agents. lightning:omniChannelStatusChanged event will be fired when the agents sets or changes their Status in the Omni-Channel widget.
Sample Aura Component:
Component:
<aura:component
implements="flexipage:availableForAllPageTypes"
access="global" >
<lightning:omniToolkitAPI
aura:id="omniToolkit" />
<aura:handler
event="lightning:omniChannelStatusChanged"
action="{! c.onStatusChanged }"/>
</aura:component>
Controller:
( {
onStatusChanged : function( component, event, helper ) {
let statusId = event.getParam('statusId');
let channels = event.getParam('channels');
let statusName = event.getParam('statusName');
let statusApiName = event.getParam('statusApiName');
console.log(
'statusId is',
statusId
);
console.log(
'channels are',
channels
);
console.log(
'statusName is',
statusName);
console.log(
'statusApiName is',
statusApiName
);
}
} )
Output:
Also, we can use UserServicePresence object/entity to track the Salesforce Omni-Channel Presence Status Changes.