Newer Version Available

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

getServicePresenceStatusChannels for Lightning Experience

Retrieves the service channels that are associated with an Omni-Channel user’s current presence status.

Sample Code

Component code:

1<aura:component implements="flexipage:availableForAllPageTypes" access="global" >
2    <lightning:omniToolkitAPI aura:id="omniToolkit" />
3    <lightning:button label="Get Status Channels" onclick="{! c.getStatusChannels }" /> 
4</aura:component>

Controller code:

1({
2    getStatusChannels: function(cmp, evt, hlp) {
3        var omniAPI = cmp.find("omniToolkit");
4        omniAPI.getServicePresenceStatusChannels().then(function(result) {
5            var channels = JSON.parse(result.channels);
6            //For example purposes, just retrieve the first channel
7            console.log('First channel ID is: ' + channels[0].channelId);
8            console.log('First channel developer name is: ' + channels[0].developerName);
9        }).catch(function(error) {
10            console.log(error);
11        });
12    }
13})

Response

This method returns a promise that, upon success, resolves to an array of channel objects, containing the following fields.

Name Type Description
channelId String The ID of the channel.
developerName String The name of the channel.