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.

Arguments

Name Type Description
callback function JavaScript method to call when the channels associated with a presence status are retrieved.

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({
5            callback: function(result) {
6                if (result.success) {
7                    console.log('Retrieved Service Presence Status Channels successfully');
8                    var channels = JSON.parse(result.channels);
9                    //For example purposes, just retrieve the first channel
10                    console.log('First channel ID is: ' + channels[0].channelId);
11                    console.log('First channel developer name is: ' + channels[0].developerName);
12                } else {
13                    console.log('Get Service Presence Status Channels failed');
14                }
15            }
16        });
17    }
18})

Response

This method is asynchronous so it returns its response in an object in a callback method. The response object contains the following properties:

Name Type Description
success boolean true if retrieving the current presence status channels was successful; false otherwise.
channels JSON string of channel objects Returns the IDs and API names of the channels associated with the presence status.