Newer Version Available

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

getServicePresenceStatusId for Lightning Experience

Retrieves an agent’s current presence status.

Arguments

Name Type Description
callback function JavaScript method to call when the agent’s presence status is 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" onclick="{! c.getStatus }" />
4</aura:component>

Controller code:

1({
2    getStatus: function(cmp, evt, hlp) {
3        var omniAPI = cmp.find("omniToolkit");
4        omniAPI.getServicePresenceStatusId({
5            callback: function(result) {
6                if (result.success) {
7                    console.log('Get Status Id successful');
8                    console.log('Status Id is: ' + result.statusId);
9                } else {
10                    console.log('Get Status Id failed');
11                }
12            }
13        });
14    }        
15})

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 presence status ID was successful; false otherwise.
statusName string The name of the agent’s current presence status.
statusApiName string The API name of the agent’s current presence status.
statusId string The ID of the agent’s current presence status.